/*
 * Các tab nội dung kiểu Lichess (đợt 3): Câu đố, Học tập, Xem.
 * Danh sách thành khối bo góc, các hàng ngăn bằng đường kẻ mảnh, tiêu đề khối chữ nhạt (giống Cài đặt – shell.css).
 * Chỉ áp dụng trong trang (.pg-body); hộp thoại cũ không đổi.
 */

/* ============================ Câu đố ============================ */
.pz-today {
  display: grid; grid-template-columns: minmax(120px, 40%) 1fr; gap: 14px; align-items: center;
  padding: 12px; border-radius: 12px; background: var(--panel);
}
.pz-today[hidden] { display: none; }
.pzt-board svg { width: 100%; display: block; border-radius: 8px; background: var(--board); }
.pzt-board .rgrid line { stroke: var(--board-grid); stroke-width: 1; }
.pzt-board .rx line { stroke: var(--x); stroke-width: 3; stroke-linecap: round; }
.pzt-board .ro { fill: none; stroke: var(--o); stroke-width: 3; }
.pzt-info { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pzt-info h3 { margin: 0; font-size: var(--fs-lg); font-weight: var(--fw-semibold); }
.pzt-info p { margin: 0; font-size: var(--fs-sm); }
.pzt-info small { color: var(--muted); font-size: var(--fs-xs); }
.pzt-info .primary { align-self: flex-start; margin-top: 4px; }
.pg-body .pz-stats { margin: 0; }
.pg-body .pz-modes { gap: 0; background: var(--panel); border-radius: 12px; overflow: hidden; }
.pg-body .pz-mode { position: relative; border-radius: 0; background: none; padding: 12px 40px 12px 16px; }
.pg-body .pz-mode + .pz-mode::before { content: ""; position: absolute; left: 54px; right: 0; top: 0; border-top: 1px solid var(--line); }
.pg-body .pz-mode::after { content: "›"; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: var(--fs-lg); }
.pg-body .pz-mode .ico { width: 24px; height: 24px; }
.pg-body .pz-mode small { font-size: var(--fs-xs); }
.pg-body .pz-mode[data-pz="daily"] { display: none; } /* đã có thẻ Câu đố hôm nay ở trên */

/* ============================ Học tập ============================ */
#page-learn .pg-body > h3 { margin: 10px 4px -4px; font-size: var(--fs-sm); font-weight: var(--fw-regular); color: var(--muted); }
#page-learn .learn-list { background: var(--panel); border-radius: 12px; overflow: hidden; gap: 0; }
#page-learn .learn-list li { position: relative; padding: 10px 12px; gap: 12px; }
#page-learn .learn-list li + li::before { content: ""; position: absolute; left: 54px; right: 0; top: 0; border-top: 1px solid var(--line); }
#page-learn .style-card { background: var(--panel); }
#page-learn .styles-more { justify-content: center; }
#page-learn #learn-progress { margin: -4px 4px 0; }

/* ============================ Xem ============================ */
#page-watch #tv-card { padding: 0; overflow: hidden; }
#page-watch #tv-card > h3 { padding: 12px 16px 4px; justify-content: space-between; }
#page-watch #tv-list { gap: 0; }
#page-watch #tv-list li { position: relative; padding: 12px 16px; gap: 12px; }
#page-watch #tv-list li + li::before { content: ""; position: absolute; left: 16px; right: 0; top: 0; border-top: 1px solid var(--line); }
#page-watch #tv-list li.empty { padding: 16px; }

/* ============================ Lịch sử đấu (history.js) ============================ */
.hist-vis { display: flex; flex-direction: column; gap: 6px; }
.hist-vis[hidden] { display: none; }
#history .games li { flex-wrap: wrap; row-gap: 6px; }
.hist-acts { display: flex; gap: 6px; margin-left: auto; flex: 1 1 100%; justify-content: flex-end; } /* nút xuống dòng riêng: tên đối thủ không bị cắt */
.hist-acts .ico { width: 16px; height: 16px; }
#history-more[hidden] { display: none; }

/* ============================ Lịch sử đấu trên máy này (local-history.js, local-save.js) ============================ */
.hist-tabs[hidden], #history-local[hidden], #history-online[hidden], #history-note[hidden] { display: none; }
#history-online { display: flex; flex-direction: column; gap: 10px; }
#history-local { display: flex; flex-direction: column; gap: 10px; }
.lh-head { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--seg-bg, color-mix(in srgb, var(--text) 6%, transparent)); font-size: var(--fs-sm); line-height: 1.45; }
.lh-head > .ico { width: 22px; height: 22px; flex: none; margin-top: 2px; color: var(--muted); }
.lh-head small { color: var(--muted); }
.lh-tools { justify-content: flex-end; gap: 6px; }
.lh-tools .danger-btn { align-self: center; padding: 6px 12px; }
.lh-list .lh-pick { width: 20px; height: 20px; flex: none; accent-color: #e5392f; }
.lh-list li.picked { background: color-mix(in srgb, #e5392f 8%, transparent); }
.lh-an { color: #2fb45a; font-weight: var(--fw-semibold); }
#history-local > .hint { margin: 0; }
/* Hỏi lưu ván */
#lh-ask .dlg { gap: 10px; max-width: 420px; }
#lh-ask p { margin: 0; text-align: start; }
.lh-why { font-weight: var(--fw-semibold); }
.lh-ask-list { max-height: 40vh; overflow-y: auto; margin: 0; padding: 0; }
.lh-ask-list li { flex-wrap: nowrap; }
#lh-ask-pick[hidden], #history-save-all[hidden] { display: none; }
.lh-saved { display: inline-flex; align-items: center; padding: 0 6px; }
.lh-saved .ico { width: 18px; height: 18px; }
.lh-always { border-radius: 12px; padding: 8px 10px; background: color-mix(in srgb, var(--text) 5%, transparent); }
.row.end { justify-content: flex-end; }
/* Cài đặt */
.li.off { opacity: 0.5; }
.li.lh-store { cursor: default; }
.danger-li .li-t, .danger-li .li-ic { color: #e5392f; }
.danger-li:disabled { opacity: 0.5; }
.hint.pad { padding: 0 6px; }

/* ============================ Thiết bị (devices.js) ============================ */
.devices li.dev { align-items: flex-start; padding: 8px 2px; border-bottom: 1px solid var(--panel-border); }
.devices li.dev:last-of-type { border-bottom: 0; }
.devices .dev-ic { width: 24px; height: 24px; flex: none; margin-top: 2px; color: var(--muted); }
.devices li.cur .dev-ic { color: var(--accent, #2fb45a); }
.devices .pn { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.devices .pn small { color: var(--muted); font-size: var(--fs-xs); }
.devices .dev-st.on { color: #2fb45a; font-weight: var(--fw-semibold); }
#devices-card[hidden], #devices-others[hidden] { display: none; }
.devices .pn b, .devices .pn small { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
