/* PTC 64 quẻ Kinh Dịch — dùng biến màu của giao diện mới (tc-ui.css), có giá trị dự phòng */
.ptc-64q {
  --q-red: var(--tc-red-2, #8b0000); --q-ink: var(--tc-ink, #2b1a10); --q-text: var(--tc-text, #3a2a1e);
  --q-muted: var(--tc-muted, #7a6a5a); --q-line: var(--tc-line, #e4d3b4); --q-card: var(--tc-card, #fffaf0);
  --q-blue: #1a3aa8; --q-yang: #2457a6;
  color: var(--q-text);
}
.ptc-64q *, .ptc-64q *::before, .ptc-64q *::after { box-sizing: border-box; }
.q64-lead { margin: 0 0 10px; font-size: 15.5px; color: var(--q-muted); }

/* xếp loại cát hung */
.q64-legend { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.q64-rate { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; line-height: 1.6; white-space: nowrap; }
.q64-rate--tt { background: #b71c1c; color: #fff; }
.q64-rate--t { background: #d84315; color: #fff; }
.q64-rate--tth { background: #f3c14b; color: #4a2a00; }
.q64-rate--tr { background: #e7dfc6; color: #4a3a20; }
.q64-rate--th { background: #c9c3b6; color: #2e2a24; }
.q64-rate--hh { background: #5d5750; color: #fff; }

/* hình quẻ: 6 vạch */
.q64-sym { display: inline-flex; flex-direction: column; gap: 4px; width: 46px; }
.q64-sym i { display: flex; justify-content: space-between; height: 6px; }
.q64-sym i.y { background: var(--q-yang); border-radius: 1px; }
.q64-sym i.n b { display: block; width: 42%; height: 100%; background: var(--q-yang); border-radius: 1px; }
.q64-sym--lg { width: 92px; gap: 8px; flex: none; }
.q64-sym--lg i { height: 12px; }

/* lưới 64 quẻ: 8 cột trên máy tính */
.q64-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; }
.q64-grid li { margin: 0; min-width: 0; }
.q64-cell { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; padding: 22px 4px 10px; border: 1px solid var(--q-line);
  border-radius: 12px; background: var(--q-card); color: var(--q-ink); text-decoration: none; text-align: center; transition: transform .15s, box-shadow .15s, border-color .15s; }
.q64-cell:hover, .q64-cell:focus-visible, .q64-cell.is-on { transform: translateY(-2px); border-color: var(--q-red); box-shadow: 0 6px 16px rgba(80, 30, 0, .14); color: var(--q-ink); }
.q64-cell:focus-visible { outline: 2px solid var(--q-red); outline-offset: 2px; }
.q64-cell__no { position: absolute; top: 5px; left: 7px; font-size: 12px; font-weight: 700; color: var(--q-muted); }
.q64-cell::after { content: ""; position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: #e7dfc6; }
.q64-cell--tt::after { background: #b71c1c; } .q64-cell--t::after { background: #d84315; } .q64-cell--tth::after { background: #f3c14b; }
.q64-cell--th::after { background: #c9c3b6; } .q64-cell--hh::after { background: #5d5750; }
.q64-cell__name { font-size: 14px; font-weight: 700; line-height: 1.25; color: var(--q-red); overflow-wrap: anywhere; }
.q64-cell__cn { font-size: 13px; color: var(--q-muted); }

/* nội dung chi tiết nằm sẵn trong trang (cho máy tìm kiếm), chỉ hiện trong hộp */
.q64-arts { display: none; }

/* hộp diễn giải */
html.q64-lock { overflow: hidden; }
.q64-dlg[hidden] { display: none; }
.q64-dlg { position: fixed; inset: 0; z-index: 100000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.q64-dlg__back { position: absolute; inset: 0; background: rgba(30, 15, 5, .55); }
.q64-dlg__box { position: relative; width: min(860px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; overscroll-behavior: contain; border-radius: 16px;
  background: #fffdf7; box-shadow: 0 20px 50px rgba(0, 0, 0, .35); outline: none; }
.q64-dlg__bar { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--q-red); color: #fff; border-radius: 16px 16px 0 0; }
.q64-dlg__title { flex: 1; min-width: 0; text-align: center; font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q64-nav, .q64-close { flex: none; width: 36px; height: 36px; padding: 0; border: 1px solid rgba(255, 255, 255, .45); border-radius: 50%; background: transparent; color: #fff;
  font-size: 20px; line-height: 1; cursor: pointer; margin: 0; min-height: 0; }
.q64-nav:hover, .q64-close:hover { background: rgba(255, 255, 255, .18); }
.q64-close { font-size: 16px; }
.q64-dlg__body { padding: 20px 22px 24px; }

/* bài diễn giải */
.q64-art__head { display: flex; align-items: center; gap: 20px; margin-bottom: 14px; }
.q64-art__id { min-width: 0; }
.q64-art__no { margin: 0; font-size: 13.5px; color: var(--q-muted); font-weight: 600; }
.ptc-64q .q64-art__name { margin: 2px 0 6px; font-size: 26px; line-height: 1.25; color: var(--q-red); text-transform: none; letter-spacing: 0; }
.q64-art__name span { font-size: .8em; color: var(--q-muted); font-weight: 600; }
.q64-art__tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0 0 6px; }
.q64-theme { font-weight: 700; color: var(--q-blue); font-size: 15px; }
.q64-art__tri { margin: 0; font-size: 14.5px; color: var(--q-text); }
.q64-tho { margin: 0 0 16px; padding: 12px 16px; border-left: 4px solid var(--q-red); border-radius: 0 10px 10px 0; background: #fbf1df; font-style: italic; font-size: 15.5px; color: #5d2a0a; }
.ptc-64q .q64-sec h3, .ptc-64q .q64-card h3 { margin: 0 0 6px; font-size: 17px; color: var(--q-red); text-transform: none; letter-spacing: 0; }
.q64-sec { margin: 0 0 16px; }
.q64-sec p, .q64-card p { margin: 0 0 6px; font-size: 15.5px; line-height: 1.65; }
.q64-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0 0 16px; }
.q64-card { min-width: 0; padding: 12px 14px; border: 1px solid var(--q-line); border-radius: 12px; background: var(--q-card); }
.q64-kinh { padding: 12px 14px; border-radius: 12px; background: #f3f1ea; border: 1px solid #ddd6c4; }
.q64-hao { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column-reverse; gap: 8px; }
.q64-hao li { display: flex; align-items: flex-start; gap: 12px; margin: 0; font-size: 15px; line-height: 1.55; }
.q64-hao__bar { flex: none; display: flex; justify-content: space-between; width: 40px; height: 7px; margin-top: 8px; }
.q64-hao__bar i { display: block; height: 100%; background: var(--q-yang); border-radius: 1px; }
.q64-hao__bar.y i { width: 100%; }
.q64-hao__bar.n i { width: 42%; }

/* máy tính bảng / điện thoại */
@media (max-width: 900px) { .q64-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .q64-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .q64-cell { padding: 20px 2px 8px; }
  .q64-cell__name { font-size: 12.5px; }
  .q64-cards { grid-template-columns: minmax(0, 1fr); }
  .q64-dlg { padding: 0; align-items: stretch; }
  .q64-dlg__box { max-height: 100vh; height: 100%; border-radius: 0; }
  .q64-dlg__bar { border-radius: 0; }
  .q64-dlg__body { padding: 16px; }
  .q64-art__head { gap: 14px; }
  .q64-sym--lg { width: 64px; gap: 6px; }
  .q64-sym--lg i { height: 9px; }
  .ptc-64q .q64-art__name { font-size: 21px; }
}
