/* Sổ tay đi biển (trinh_khach/src/so_ca_ui.ts, thanh_tuu_ui.ts, chai_thu_ui.ts): sổ cá · thành tựu + danh hiệu · chai thư.
   Theo khung bảng thống nhất (.bang.lon): tiêu đề + nút đóng 44px + tab + thân cuộn; vùng bấm ≥ 44px trên cảm ứng. */
#bang-st { width: min(800px, calc(100vw - 20px)); height: min(580px, calc(var(--cao, 100vh) - 20px)); }
.tab-st { display: flex; gap: 6px; padding: 0 10px 8px; flex: 0 0 auto; }
.tab-st button { flex: 1; position: relative; padding: 6px 10px; min-height: 40px; border-radius: 7px; background: rgba(79, 227, 255, .06); border: 1px solid var(--vien-mo);
  color: var(--chu-mo); font-weight: 700; font-size: 13px; white-space: nowrap; }
.tab-st button.chon { color: var(--chu); background: rgba(79, 227, 255, .2); border-color: var(--vien); }
.tab-st .cham { top: -6px; right: -4px; }
#than-st { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; padding: 0 10px 10px; }
#than-st > .trong { margin: auto; }
#than-st button { font: inherit; color: inherit; }
#than-st button.chinh, .st-nut button { min-height: 40px; padding: 6px 14px; border-radius: 7px; border: 1px solid var(--vien); background: rgba(79, 227, 255, .26); font-weight: 700; white-space: nowrap; }
#than-st button:disabled { opacity: .45; }
#than-st button:active:not(:disabled) { transform: translateY(1px); }

/* danh hiệu: thẻ nhỏ cạnh tên (dùng cả ở bảng Bạn bè, xếp hạng, hồ sơ) */
.dh-the { display: inline-block; vertical-align: middle; padding: 1px 7px; border-radius: 99px; border: 1px solid var(--mau-dh, var(--vien)); color: var(--mau-dh, var(--chu));
  background: rgba(0, 0, 0, .28); font-size: 11px; font-weight: 700; letter-spacing: 0; line-height: 1.45; white-space: nowrap; text-shadow: none; }
.dh-the.p4, .dh-the.p5 { box-shadow: 0 0 6px var(--mau-dh); }
.hs-dh { margin: 2px 0 1px; }
.hs-dh .dh-the { font-size: 12px; margin-left: -1px; }

/* phần thưởng (mốc sổ cá, thành tựu) */
.st-thuong { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 12px; margin-top: 3px; }
.st-diem { color: var(--vang); font-weight: 800; }
.st-vat { display: inline-flex; align-items: center; gap: 2px; color: var(--chu); }
.st-vat img { width: 20px; height: 20px; image-rendering: pixelated; }
.st-nut { margin-top: 10px; display: grid; }

/* ================= sổ cá ================= */
.sc { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 6px; }
.sc-dau { flex: 0 0 auto; display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; }
.sc-tien { flex: 1 1 150px; min-width: 130px; font-size: 13px; color: var(--chu-mo); }
.sc-tien b { color: var(--xanh); font-size: 16px; }
.sc-tien .thanh { margin: 3px 0 0; }
.sc-moc-ds { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.sc-moc { min-width: 44px; min-height: 36px; padding: 2px 9px; border-radius: 18px; border: 1px solid var(--vien-mo); background: rgba(79, 227, 255, .06); font-weight: 800; font-size: 13px; color: var(--chu-mo); }
.sc-moc.da { color: var(--xanh); border-color: rgba(111, 255, 210, .5); }
.sc-moc.duoc { color: #3a2500; border-color: #ffe066; background: linear-gradient(#ffe066, #e0a020); box-shadow: 0 0 10px rgba(255, 216, 74, .6); animation: scNhay 1.2s ease-in-out infinite; }
.sc-moc.chon { outline: 2px solid var(--vien); outline-offset: 1px; }
.sc-than { flex: 1 1 auto; min-height: 0; display: flex; gap: 10px; }
.sc-luoi { flex: 1 1 auto; min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 6px; align-content: start; justify-items: center; padding: 3px; }
.sc-chu { grid-column: 1 / -1; justify-self: stretch; padding: 4px 2px 2px; }
.sc-o { width: 56px; height: 56px; padding: 0; position: relative; border-radius: 9px; border: 1px solid var(--vien-mo); background: rgba(79, 227, 255, .05);
  display: flex; align-items: center; justify-content: center; }
.sc-o img { width: 48px; height: 48px; image-rendering: pixelated; pointer-events: none; }
.sc-o.co { border-color: var(--mau-pham); background: linear-gradient(rgba(255, 255, 255, .04), rgba(0, 0, 0, .18)); }
.sc-o.chua img { filter: brightness(0) invert(1); opacity: .2; }
.sc-o.chua { border-style: dashed; }
.sc-o.dang { box-shadow: 0 0 0 1px var(--xanh), 0 0 9px rgba(111, 255, 210, .7); animation: scNhay 1.6s ease-in-out infinite; }
.sc-o.chon { outline: 2px solid var(--vien); outline-offset: 1px; background: rgba(79, 227, 255, .2); }
.sc-so { position: absolute; right: 3px; bottom: 0; font-size: 11px; font-weight: 800; text-shadow: 0 1px 2px #000, 0 0 2px #000; }
.sc-hoi { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 900; color: var(--mau-pham); text-shadow: 0 0 4px #000, 0 0 2px #000; }
@keyframes scNhay { 50% { filter: brightness(1.25); } }
.sc-ct { flex: 0 0 258px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; border-left: 1px solid var(--vien-mo); padding: 2px 2px 4px 10px; font-size: 13px; }
.sc-ct-dau { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.sc-anh { flex: 0 0 auto; width: 76px; height: 76px; border-radius: 12px; border: 1px solid var(--mau-pham, var(--vien-mo)); background: radial-gradient(circle at 50% 40%, rgba(255, 255, 255, .12), rgba(0, 0, 0, .25));
  display: flex; align-items: center; justify-content: center; }
.sc-anh img { width: 64px; height: 64px; image-rendering: pixelated; }
.sc-anh.chua img { filter: brightness(0) invert(1); opacity: .22; }
.sc-anh.chua { border-style: dashed; }
.sc-moc-so { font-size: 28px; color: var(--vang); text-shadow: 0 0 10px rgba(255, 216, 74, .6); }
.sc-ten { font-size: 17px; font-weight: 900; line-height: 1.15; text-shadow: 0 0 8px rgba(0, 0, 0, .5); }
.sc-so-lieu { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 6px; }
.sc-so-lieu > div { border: 1px solid var(--vien-mo); border-radius: 8px; padding: 4px 7px; background: rgba(79, 227, 255, .04); min-width: 0; }
.sc-so-lieu span { display: block; font-size: 11px; color: var(--chu-mo); }
.sc-so-lieu b { font-size: 15px; color: var(--vang); }
.sc-so-lieu small { display: block; font-size: 11px; color: var(--chu-mo); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-dang-co { color: var(--xanh); font-weight: 700; font-size: 12px; margin: 2px 0 5px; }
.sc-mota { color: var(--chu-mo); font-size: 12.5px; margin-bottom: 4px; font-style: italic; }
.sc-muc { font-size: 11px; letter-spacing: 1px; color: var(--vien); font-weight: 700; margin: 7px 0 3px; }
.sc-gy { display: grid; grid-template-columns: 38px 1fr; gap: 6px; font-size: 12.5px; padding: 2px 0; }
.sc-gy span { color: var(--chu-mo); }
.sc-gy b { font-weight: 600; }
.sc-vat { width: 18px; height: 18px; image-rendering: pixelated; vertical-align: -4px; }
.sc-ghi { margin-top: 8px; }

/* ================= thành tựu ================= */
.ttu, .ct { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; }
.ttu-dh { border: 1px solid rgba(255, 216, 74, .4); border-radius: 9px; padding: 5px 8px; background: rgba(255, 216, 74, .05); }
.ttu-dh-dau { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 34px; }
.ttu-dh-dau .ttu-doi { min-height: 36px; padding: 4px 12px; border-radius: 7px; border: 1px solid var(--vien-mo); background: rgba(79, 227, 255, .12); font-weight: 700; }
.ttu-phai { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--chu-mo); }
.ttu-dat b { color: var(--xanh); font-size: 16px; }
.ttu-dh-dau > .dh-the { font-size: 13px; padding: 2px 10px; }
.ttu-dh-ds { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.ttu-dh-o { min-height: 40px; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--vien-mo); background: rgba(79, 227, 255, .05); font-size: 12px; color: var(--chu-mo); }
.ttu-dh-o.chon { border-color: var(--xanh); background: rgba(111, 255, 210, .14); }
.ttu-dh-o .dh-the { font-size: 12px; pointer-events: none; }
.ttu-loc, .ct-loc { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; position: sticky; top: 0; z-index: 1; background: var(--nen-dam); padding: 8px 0 6px; margin-top: -4px; }
.ttu-loc::-webkit-scrollbar, .ct-loc::-webkit-scrollbar { display: none; }
.ttu-loc button, .ct-loc button { flex: 0 0 auto; position: relative; min-height: 36px; padding: 4px 11px; border-radius: 18px; border: 1px solid var(--vien-mo); background: rgba(79, 227, 255, .06);
  color: var(--chu-mo); font-weight: 700; font-size: 12.5px; white-space: nowrap; }
.ttu-loc button.chon, .ct-loc button.chon { color: var(--chu); border-color: var(--vang); background: rgba(255, 216, 74, .14); }
.ttu-loc .cham, .ct-loc .cham { top: -5px; right: -3px; }
.ttu-ds { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.ttu-dong { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; border: 1px solid var(--vien-mo); border-radius: 9px; padding: 7px 9px; background: rgba(79, 227, 255, .03); }
.ttu-dong.dat { border-color: var(--vang); background: rgba(255, 216, 74, .07); box-shadow: 0 0 10px rgba(255, 216, 74, .18); }
.ttu-dong.da { border-color: rgba(111, 255, 210, .4); opacity: .72; }
.ttu-ten { font-weight: 800; font-size: 14px; }
.ttu-dong .thanh { margin: 4px 0 2px; height: 6px; }
.ttu-nut { min-width: 62px; text-align: center; }
.ttu-tien { font-weight: 800; font-size: 13px; color: var(--chu-mo); }
.ttu-da { font-size: 12px; font-weight: 700; color: var(--xanh); white-space: nowrap; }

/* ================= chai thư ================= */
.ct-loc button { flex: 1 0 auto; }
.ct-ds { display: grid; gap: 7px; }
.ct-the { border: 1px solid var(--vien-mo); border-radius: 10px; padding: 8px 10px; background: rgba(79, 227, 255, .035); }
.ct-the.moi { border-color: var(--vang); box-shadow: 0 0 10px rgba(255, 216, 74, .2); }
.ct-the.he { border-color: rgba(111, 255, 210, .45); background: rgba(111, 255, 210, .05); }
.ct-dau { display: flex; align-items: center; gap: 8px; }
.ct-anh { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 8px; image-rendering: pixelated; background: rgba(79, 227, 255, .1); object-fit: contain; }
.ct-anh.chai { background: none; }
.ct-ai { min-width: 0; }
.ct-ten { cursor: pointer; text-decoration: underline; text-decoration-color: rgba(226, 251, 255, .35); text-underline-offset: 3px; }
.ct-dau em { color: var(--vang); font-style: normal; font-weight: 800; }
.ct-nd { margin: 7px 0; padding: 8px 11px; border-radius: 8px; background: rgba(250, 240, 210, .09); border-left: 3px solid rgba(255, 216, 74, .55); font-size: 14.5px; line-height: 1.4;
  overflow-wrap: anywhere; -webkit-user-select: text; user-select: text; }
.ct-the.he .ct-nd { border-left-color: rgba(111, 255, 210, .6); }
.ct-nut { display: flex; gap: 6px; flex-wrap: wrap; }
.ct-nut button { min-height: 40px; padding: 5px 12px; border-radius: 7px; border: 1px solid var(--vien-mo); background: rgba(79, 227, 255, .1); font-weight: 700; font-size: 13px; white-space: nowrap; }
.ct-nut button.tim { border-color: #ff8fb0; color: #ffc0d2; background: rgba(255, 110, 150, .14); }
.ct-nut button.da-tim:disabled { opacity: 1; color: #ff8fb0; border-color: rgba(255, 143, 176, .45); }
.ct-nut button.bao { margin-left: auto; color: var(--chu-mo); }
.ct-tim-so { color: #ff8fb0; font-weight: 800; }
.ct-tong { padding: 2px 2px 4px; }
.ct-viet { display: grid; gap: 7px; }
#ct-nd { width: 100%; box-sizing: border-box; min-height: 74px; resize: none; padding: 9px 11px; border-radius: 9px; border: 1px solid var(--vien-mo); background: rgba(0, 10, 20, .6); color: var(--chu);
  font: inherit; font-size: 16px; line-height: 1.35; outline: none; -webkit-user-select: text; user-select: text; }
#ct-nd:focus { border-color: var(--vien); }
.ct-hang { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ct-con { flex: 1 1 auto; min-width: 0; }
.ct-the.cua .ct-nd { margin-top: 0; }

/* bảng xếp hạng "Cá kỷ lục" (xa_hoi_ui.ts) */
.kl-ca { width: 34px; height: 34px; image-rendering: pixelated; }

/* cảm ứng: mọi vùng bấm ≥ 44px */
body.cam-ung .tab-st button, body.cam-ung .sc-moc, body.cam-ung .ttu-loc button, body.cam-ung .ct-loc button, body.cam-ung .ct-nut button,
body.cam-ung .ttu-dh-dau .ttu-doi, body.cam-ung .ttu-dh-o, body.cam-ung #than-st button.chinh, body.cam-ung .st-nut button { min-height: 44px; }
body.cam-ung .ttu-nut button { min-width: 62px; }

@media (max-width: 620px), (max-height: 500px) {
  #bang-st { width: auto; height: auto; }
  #than-st { padding: 0 8px 8px; }
  .tab-st { padding: 0 8px 6px; }
}
/* màn ngang thấp (điện thoại 844×390): gọn hàng đầu, cột chi tiết hẹp lại chút */
@media (max-height: 500px) and (min-width: 621px) {
  .sc { gap: 4px; }
  .sc-ct { flex-basis: 250px; }
  .sc-anh { width: 60px; height: 60px; }
  .sc-anh img { width: 52px; height: 52px; }
}
/* màn dọc / hẹp: chi tiết nằm dưới lưới */
@media (max-width: 620px) {
  .sc-than { flex-direction: column; gap: 6px; }
  .sc-luoi { flex: 1 1 50%; }
  .sc-ct { flex: 1 1 50%; border-left: 0; border-top: 1px solid var(--vien-mo); padding: 8px 2px 2px; }
  .ttu-ds { grid-template-columns: 1fr; }
  .ct-nut button.bao { margin-left: 0; }
}
