/* Trang donate. Màu, font, khung nhập, nút dùng chung trong /styles.css */

:root {
  --t-dong: #d0915c;
  --t-bac: #d5dce4;
  --t-vang: #f5c451;
  --t-kimcuong: #8ee6ff;
}

/* Màu chủ đạo xanh chanh, khớp banner Donate ở trang bio. Hạng Vàng vẫn giữ màu vàng riêng (--t-vang) */
body.dn-theme {
  --gold: #b8f03a;
  --acc-rgb: 184, 240, 58;
  --acc-hi: #e2ff9a;
  --acc-lo: #6fb514;
  --line: rgba(184, 240, 58, .16);
  --metal: linear-gradient(180deg, #ffffff 0%, #d9dee7 36%, #7d8696 60%, #f2f5fa 80%, #5b6372 100%);
}
.dn-theme .btn-gold { background: var(--gold); color: #142000; }
@media (hover: hover) { .dn-theme .btn-gold:hover { background: var(--acc-hi); } }

/* Banner Donate ở đầu trang, giống banner ở trang bio */
.dn-hero {
  display: block;
  margin: 10px 0 0;
  border-radius: 18px;
  overflow: hidden;
  aspect-ratio: 1100 / 405;
}
.dn-hero img { display: block; width: 100%; height: 100%; object-fit: cover; }

.dn { padding-top: calc(14px + env(safe-area-inset-top)); }

/* ---------- Thanh trên ---------- */
.dn-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 48px; }
.dn-home { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; }
.dn-coin {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #111;
}
.dn-coin { overflow: hidden; }
.dn-coin img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dn-coin span {
  font: 400 18px/1 var(--display);
  background: var(--metal);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
/* Nút xem nhanh quyền lợi, top */
/* Chữ thường, không khung, không biểu tượng: ba lối tắt nằm ngay trên đầu nên không cần lặp lại bên dưới */
.dn-quick { display: flex; gap: 2px; margin-left: auto; }
.dn-quick button {
  height: 38px;
  padding: 0 8px;
  border: 0;
  background: none;
  color: var(--ivory);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  text-decoration: underline;
  text-decoration-color: rgba(var(--acc-rgb), .7);
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}
.dn-quick button:hover { color: var(--gold); }
.dn-acct { white-space: nowrap; }
.dn-acct .ti { font-size: 18px; }
@media (max-width: 420px) {
  .dn-home-text { display: none; }
  /* Chưa đăng nhập: chỉ để biểu tượng, vì đã có khung mời đăng nhập to bên dưới */
  .dn-acct:not(.in) { width: 38px; padding: 0; justify-content: center; }
  .dn-acct:not(.in) .dn-acct-label { display: none; }
  .dn-acct.in { max-width: 120px; overflow: hidden; }
}

/* Bảng thông tin trượt lên */
.info-sheet { width: min(100%, 560px); }
.info-tabs {
  position: sticky;
  top: -26px;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin: 4px 44px 16px 0;
  padding: 4px;
  border-radius: 12px;
  background: #1c1c1c;
}
.info-tabs button {
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 0;
  border-radius: 9px;
  background: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--smoke);
  white-space: nowrap;
}
.info-tabs .ti { font-size: 16px; }
.info-tabs button[aria-selected="true"] { background: rgba(var(--acc-rgb), .16); color: var(--gold); }
.info-pane[hidden] { display: none; }
.info-sheet h3.perk-h { font-size: 14px; font-weight: 700; }
.info-pane { animation: step-in .35s var(--ease-out); }

.dn-acct {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: #1a1a1a;
  font-size: 13.5px;
  font-weight: 600;
}
.dn-acct[hidden] { display: none; }
.dn-acct.in { padding-left: 4px; }
.dn-acct .av { width: 30px; height: 30px; font-size: 14px; }

.dn-title {
  margin: 26px 0 0;
  font: 400 clamp(72px, 24vw, 132px)/.9 var(--display);
  letter-spacing: .01em;
  padding-top: .1em;
  background: var(--metal);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 28px rgba(var(--acc-rgb), .25));
}
.dn-lead { margin: 14px 0 22px; font-size: 16px; color: var(--ivory); }

/* Ảnh đại diện tròn */
.av {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #222;
  font: 400 17px/1 var(--display);
  color: var(--gold);
  text-transform: uppercase;
}
.av img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Mục tiêu ---------- */
.goal {
  margin-bottom: 16px;
  padding: 16px;
  border-radius: 18px;
  background: #161616;
}
.goal[hidden] { display: none; }
.goal-head { display: grid; gap: 2px; margin-bottom: 12px; }
.goal-label { font-size: 12px; font-weight: 600; color: var(--gold); }
.goal-head strong { font-size: 16px; }
.goal-bar { height: 10px; border-radius: 999px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.goal-bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--gold);
  transition: width 1.4s var(--ease-out);
}
.goal-nums { display: flex; justify-content: space-between; margin-top: 8px; font-size: 13px; color: var(--smoke); font-variant-numeric: tabular-nums; }
.goal-nums b { color: var(--ivory); }

/* ---------- Khung donate ---------- */
.dn-card {
  padding: 20px 18px;
  border-radius: 22px;
  background: #121212;
}
.btn-big { width: 100%; height: 54px; font-size: 16px; }
.btn-gold:disabled { opacity: .6; }
.dn-rule { margin: -4px 0 0; text-align: center; font-size: 13px; color: #a9a9a9; }
/* Quyền lợi theo số tiền đang chọn: mỗi quyền lợi một dòng, có dấu tích, thay cho một câu dài nối bằng dấu chấm giữa */
.perk-now { margin: 4px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 14px; line-height: 1.45; color: var(--ivory); }
.perk-now:empty { display: none; }
.perk-now li { display: flex; gap: 8px; align-items: flex-start; }
.perk-now .ti { flex: none; font-size: 16px; margin-top: 2px; color: var(--gold); }

/* ---------- Mời đăng nhập ---------- */
.join {
  display: grid;
  gap: 4px;
  padding: 16px;
  border-radius: 16px;
  background: #1c1c1c;
}
.join[hidden] { display: none; }
.join-text strong { display: block; font-size: 16px; }
.join-text p { margin: 4px 0 0; font-size: 14px; line-height: 1.5; color: #cfcfcf; }
.join-text p b { color: var(--gold); }
.join .btn-gold { justify-self: start; height: 42px; margin-top: 10px; padding: 0 20px; font-size: 14.5px; }

/* ---------- Kiểu donate ---------- */
.kinds { display: grid; grid-template-columns: repeat(var(--n, 4), 1fr); gap: 6px; }
.kinds button[hidden] { display: none; }
.kinds .kind-tier { color: var(--tc); }

/* Chưa đủ hạng */
.locked {
  display: flex;
  gap: 12px;
  padding: 14px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--tc, var(--gold)) 10%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tc, var(--gold)) 35%, transparent);
}
.locked[hidden] { display: none; }
.locked > .ti { font-size: 24px; color: var(--tc, var(--gold)); }
.locked strong { display: block; font-size: 14px; }
.locked p { margin: 4px 0 10px; font-size: 13px; color: rgba(242, 242, 242, .8); }
.locked .btn-ghost { height: 40px; padding: 0 14px; font-size: 13.5px; }

/* Chọn ảnh */
.pick {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 18px;
  border-radius: 16px;
  border: 1.5px dashed rgba(var(--acc-rgb), .4);
  background: rgba(var(--acc-rgb), .04);
  cursor: pointer;
  text-align: center;
}
.pick[hidden] { display: none; }
.pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.pick .ti { font-size: 28px; color: var(--gold); }
.pick b { font-size: 14px; }
.pick small { font-size: 12px; color: var(--smoke); }
.pick:focus-within { box-shadow: 0 0 0 2px var(--gold); }
.pick-preview { position: relative; justify-self: start; }
.pick-preview[hidden] { display: none; }
.pick-preview img { display: block; max-width: 100%; max-height: 220px; border-radius: 14px; }
.pick-preview .rec-icon { position: absolute; top: 8px; right: 8px; background: rgba(0, 0, 0, .65); }
/* Kiểu donate: một dải chữ liền, ô chọn tô đặc. Không biểu tượng phía trên */
.kinds { gap: 0; padding: 4px; border-radius: 14px; background: #1c1c1c; }
.kinds button {
  display: grid;
  justify-items: center;
  align-content: center;
  min-height: 48px;
  padding: 6px 4px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: #a9a9a9;
  transition: background .2s, color .2s, transform .3s var(--ease-spring);
}
.kinds button:active { transform: scale(.95); }
.kinds b { font-size: 14.5px; color: var(--ivory); white-space: nowrap; }
.kinds small { font-size: 12px; font-weight: 600; white-space: nowrap; }
.kinds button.locked-kind b { color: #a9a9a9; }
/* Ô đang chọn: tô đặc xanh chanh, chữ đen, thay cho viền phát sáng */
.kinds button[aria-selected="true"] { background: var(--gold); color: #142000; }
.kinds button[aria-selected="true"] b, .kinds button[aria-selected="true"] .kind-tier { color: #142000; }
.kind-pane[hidden] { display: none; }

/* Ghi âm */
.rec {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 10px 10px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .05);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
}
.rec-btn {
  flex: none;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #ff3b30;
  color: #fff;
  font-size: 24px;
  box-shadow: 0 0 0 4px rgba(255, 59, 48, .18);
  transition: transform .3s var(--ease-spring), border-radius .3s;
}
.rec-btn:active { transform: scale(.92); }
.rec.recording .rec-btn { animation: rec-pulse 1.2s ease-out infinite; }
@keyframes rec-pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 59, 48, .55); }
  100% { box-shadow: 0 0 0 16px rgba(255, 59, 48, 0); }
}
.rec-body { flex: 1; min-width: 0; display: grid; gap: 4px; }
.rec-wave { display: flex; align-items: center; gap: 2px; height: 28px; }
.rec-wave i { flex: 1; min-width: 2px; height: 12%; border-radius: 2px; background: rgba(255, 255, 255, .2); transition: height .08s linear; }
.rec.recording .rec-wave i { background: #ff6b60; }
.rec.has .rec-wave i { background: var(--gold); }
.rec-time { font-size: 12.5px; color: var(--smoke); font-variant-numeric: tabular-nums; }
.rec.recording .rec-time { color: #ff8a80; font-weight: 600; }
.rec-icon {
  flex: none;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, .07);
  font-size: 18px;
}
.rec-icon[hidden] { display: none; }

/* Bài hát */
.song-card {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .04);
  box-shadow: inset 0 0 0 1px rgba(var(--acc-rgb), .3);
  animation: step-in .4s var(--ease-out);
}
.song-card[hidden] { display: none; }
.song-card img { flex: none; width: 96px; aspect-ratio: 16 / 9; border-radius: 9px; object-fit: cover; background: #111; }
.song-meta { min-width: 0; display: grid; gap: 2px; }
.song-meta strong { font-size: 13.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.song-meta small { font-size: 12px; color: var(--smoke); }
.song-start { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--smoke); }
.song-start input { width: 96px; text-align: center; }
.paid-review { color: var(--gold) !important; font-size: 13.5px; }
.paid-review[hidden] { display: none; }

.me { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: rgba(255, 255, 255, .04); }
.me[hidden] { display: none; }
.me-av { display: contents; }
.me-who { flex: 1; min-width: 0; display: grid; }
.me-who strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-who small { font-size: 12.5px; color: var(--smoke); }
.me-lg { margin: 4px 0 14px; padding: 0; background: none; }
.me-lg .av { width: 56px; height: 56px; font-size: 24px; }
.me-lg strong { font-size: 18px; }

.tier-badge {
  flex: none;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  color: #120d04;
  background: var(--tc, var(--gold));
}
.tier-badge[hidden] { display: none; }
[data-tier="dong"] { --tc: var(--t-dong); }
[data-tier="bac"] { --tc: var(--t-bac); }
[data-tier="vang"] { --tc: var(--t-vang); }
[data-tier="kimcuong"] { --tc: var(--t-kimcuong); }

.qr-head h2, .step-paid h2 { margin: 0; font-size: 20px; }
.qr-head p { margin: 4px 0 0; color: var(--smoke); font-size: 13.5px; }
.qr-wrap img { display: block; width: 220px; height: auto; }
.qr-wrap img[hidden], .qr-wrap canvas[hidden], .qr-tag[hidden] { display: none; }
.qr-wrap canvas { display: block; width: 200px; height: 200px; }
.row-code { background: rgba(var(--acc-rgb), .12) !important; }
.code-note { margin: -6px 0 0; display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--smoke); }
.code-note .ti { color: var(--ember); font-size: 16px; }
.code-note b { color: var(--ivory); }
.dev-only { border: 1px dashed rgba(255, 255, 255, .25); }
.dev-only[hidden] { display: none; }
.dev-tag { margin-left: 6px; padding: 2px 7px; border-radius: 999px; background: rgba(255, 122, 26, .18); color: var(--ember); font-size: 10.5px; font-weight: 700; }

.step-paid { justify-items: center; text-align: center; padding: 10px 0; }
.step-paid p { margin: 0; color: var(--smoke); }
.paid-check {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--gold);
  color: #142000;
  font-size: 40px;
  animation: pop-in .7s var(--ease-spring) both;
}
@keyframes pop-in { from { transform: scale(.3); opacity: 0; } }
.paid-total { color: var(--ivory) !important; font-weight: 600; }
.paid-total[hidden] { display: none; }

/* ---------- Bảng xếp hạng ---------- */
.seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 14px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .05);
}
.seg button {
  height: 36px;
  border: 0;
  border-radius: 9px;
  background: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--smoke);
  transition: background .25s, color .25s;
}
.seg button[aria-selected="true"] { background: rgba(var(--acc-rgb), .16); color: var(--gold); }

.rank, .feed, .perks, .tiers { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rank li {
  display: grid;
  grid-template-columns: 28px auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 14px 10px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .03);
}
.rank .pos { font: 400 20px/1 var(--display); text-align: center; color: var(--smoke); }
.rank li:nth-child(1) { background: rgba(var(--acc-rgb), .14); }
.rank li:nth-child(1) .pos { color: var(--gold); font-size: 26px; }
.rank li:nth-child(2) .pos { color: var(--t-bac); }
.rank li:nth-child(3) .pos { color: var(--t-dong); }
.rank .nm { display: flex; align-items: center; gap: 6px; min-width: 0; font-weight: 600; }
.rank .nm span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank .dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--tc); }
.rank .amt { font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; }

.feed li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 12px 14px 12px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .03);
}
.feed .av { width: 36px; height: 36px; font-size: 15px; }
.feed .who { display: grid; gap: 2px; min-width: 0; }
.feed .who b { font-weight: 600; }
.feed .who q { quotes: none; font-size: 13.5px; color: rgba(242, 242, 242, .75); overflow-wrap: anywhere; }
.feed-tag { display: flex; align-items: flex-start; gap: 5px; font-size: 12.5px; line-height: 1.4; color: var(--gold); min-width: 0; }
.feed-tag .ti { flex: none; font-size: 14px; margin-top: 2px; }
.feed .who time { font-size: 12px; color: var(--smoke); }
.feed .amt { font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty { margin: 0; padding: 18px; border-radius: 14px; text-align: center; font-size: 13.5px; color: var(--smoke); background: rgba(255, 255, 255, .02); }
.empty[hidden] { display: none; }

/* ---------- Quyền lợi ---------- */
.perk-h { margin: 0 0 10px; font-size: 14px; font-weight: 700; }
.perk-h + .perks, .perk-sub + .tiers { margin-bottom: 24px; }
.perk-sub { margin: -6px 0 10px; font-size: 12.5px; color: var(--smoke); }
.perks li {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .03);
}
.perks .from { font: 400 18px/1 var(--display); color: var(--gold); letter-spacing: .02em; }
.perks .txt { font-size: 13.5px; }
.perks .soon { white-space: nowrap; font-size: 12px; font-weight: 600; color: #a9a9a9; padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, .08); }
.perks li.reached { background: rgba(var(--acc-rgb), .12); }

.tiers { grid-template-columns: 1fr; gap: 8px; }
.tiers > li {
  position: relative;
  padding: 14px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--tc) 12%, #121212);
}
.tiers strong { display: block; font: 400 22px/1 var(--display); color: var(--tc); letter-spacing: .02em; }
.tiers .from { display: block; margin: 4px 0 8px; font-size: 12.5px; color: var(--smoke); }
.tier-perks { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.tier-perks li { position: relative; padding-left: 16px; font-size: 13px; line-height: 1.45; color: rgba(242, 242, 242, .85); }
.tier-perks li::before { content: ""; position: absolute; left: 2px; top: .55em; width: 6px; height: 6px; border-radius: 50%; background: var(--tc); }
.tiers > li.mine::after {
  content: "Hạng của bạn";
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--tc);
  color: #120d04;
  font-size: 10.5px;
  font-weight: 700;
}

/* ---------- Đổi avatar ---------- */
.av-edit { position: relative; flex: none; cursor: pointer; border-radius: 50%; }
.av-edit input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.av-edit:focus-within { box-shadow: 0 0 0 2px var(--gold); }
.av-cam {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--gold);
  color: #1d1406;
  font-size: 14px;
  outline: 3px solid #121212;
  pointer-events: none;
}
.av-edit.busy .av { opacity: .5; }
.av-note { margin: -6px 0 12px; padding: 8px 12px; border-radius: 10px; background: rgba(var(--acc-rgb), .08); font-size: 12.5px; color: var(--gold); }
.av-note[hidden], .av-remove[hidden] { display: none; }
.av-remove { justify-self: start; margin: -6px 0 12px; font-size: 12.5px; }

/* ---------- Tài khoản riêng ---------- */
.or { margin: 22px 0 12px; font-size: 14px; font-weight: 600; color: #cfcfcf; }
.or[hidden] { display: none; }
.local-tabs { grid-template-columns: 1fr 1fr; }
.local-form { display: grid; gap: 14px; }
.pass { position: relative; }
.pass input { padding-right: 48px; }
.pass button {
  position: absolute;
  right: 6px;
  top: 50%;
  translate: 0 -50%;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--smoke);
  font-size: 18px;
  display: grid;
  place-items: center;
}
#lCodeField[hidden], #acctRecovery[hidden] { display: none; }
#acctRecovery { display: grid; justify-items: center; gap: 12px; text-align: center; }
#acctRecovery h3 { margin: 4px 0 0; }
#acctRecovery .sheet-sub { margin: 0; }
#acctRecovery .qr-actions { width: 100%; }
.recovery-code {
  width: 100%;
  padding: 16px;
  border-radius: 14px;
  background: rgba(var(--acc-rgb), .08);
  border: 1.5px dashed rgba(var(--acc-rgb), .55);
  font: 700 22px/1.2 var(--body);
  letter-spacing: .08em;
  color: var(--gold);
  user-select: all;
}

/* ---------- Tài khoản ---------- */
.acct-btns-col { grid-template-columns: 1fr; }
.acct-btn[hidden], .acct-hint[hidden] { display: none; }
.acct-btns-col .acct-btn { height: 50px; font-size: 15px; }
#acctSheet .acct-hint { margin-top: 12px; }
.tier-progress { display: grid; gap: 6px; margin-bottom: 16px; }
.tier-progress[hidden] { display: none; }
.tier-progress small { font-size: 12.5px; color: var(--smoke); }
.tier-progress small b { color: var(--ivory); }
#acctSheet .acct-rename { margin: 0 0 12px; }
#acctOut[hidden], #acctIn[hidden] { display: none; }

@media (min-width: 720px) {
  .dn-card { padding: 26px; }
  .tiers { grid-template-columns: repeat(3, 1fr); }
}
