/* ═══════════════════════════════════════════════════
   CHOICO THEME – homepage.css  (front-page only)
   Ý tưởng: bốn bàn cờ thật là thứ duy nhất nổi bật; phần còn lại giữ yên.
═══════════════════════════════════════════════════ */

.hp {
  --hp-panel: #0f1522;
  --hp-line:  rgba(239,232,218,.12);
  --hp-wood:  #d8a660;
  --hp-wood-hi: #e7bb7b;
  --hp-red:   #c23b2c;
  --hp-paper: #efe8da;
  --hp-muted: #9aa3b2;

  max-width: 1240px;
  margin: 0 auto;
  padding: 72px 48px 104px;
  font-family: 'Be Vietnam Pro', 'Roboto', sans-serif;
  color: var(--hp-paper);
  line-height: 1.6;
}
.hp b { font-weight: 600; color: var(--hp-paper); }

/* ─── Mở đầu ───────────────────────────────────── */
.hp-hero { container-type: inline-size; }
.hp-title {
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -.035em;
  text-wrap: balance;
}
.hp-lede {
  max-width: 56ch;
  margin-top: 18px;
  font-size: 1.125rem;
  color: var(--hp-muted);
}

/* ─── Bốn bàn cờ ───────────────────────────────── */
.hp-boards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 48px;
}
@container (min-width: 560px)  { .hp-boards { grid-template-columns: repeat(2, 1fr); gap: 40px 28px; } }
@container (min-width: 1040px) { .hp-boards { grid-template-columns: repeat(4, 1fr); } }

.hp-game { display: flex; flex-direction: column; }
.hp-board {
  display: block;
  aspect-ratio: 1;
  border-radius: 6px;
  box-shadow: 0 22px 32px -20px rgba(0,0,0,.9), 0 0 0 1px rgba(0,0,0,.35);
  transition: box-shadow .2s ease;
}
.hp-game:hover .hp-board { box-shadow: 0 26px 40px -18px rgba(0,0,0,.95), 0 0 0 1px rgba(216,166,96,.45); }
.hp-board svg { display: block; width: 100%; height: 100%; }

.hp-game-body { display: flex; flex-direction: column; flex: 1; }
.hp-game-name {
  margin-top: 18px;
  font-size: 1.375rem;
  font-weight: 800;
  letter-spacing: -.015em;
  line-height: 1.2;
}
.hp-game-desc { margin-top: 4px; font-size: .95rem; color: var(--hp-muted); }
.hp-game-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 16px; }

/* Font cho quân cờ trong SVG */
.hp-han   { font-family: 'KaiTi', 'STKaiti', 'Kaiti SC', 'Noto Serif SC', 'SimSun', serif; }
.hp-chess { font-family: 'Segoe UI Symbol', 'Apple Symbols', 'Noto Sans Symbols 2', 'DejaVu Sans', serif; }

/* ─── Nút ──────────────────────────────────────── */
.hp-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--hp-line);
  border-radius: 8px;
  font-size: .9rem; font-weight: 600;
  color: var(--hp-paper);
  transition: border-color .15s ease, background-color .15s ease;
}
.hp-btn:hover { border-color: rgba(239,232,218,.4); }
.hp-btn-main { background: var(--hp-wood); border-color: var(--hp-wood); color: #22170b; }
.hp-btn-main:hover { background: var(--hp-wood-hi); border-color: var(--hp-wood-hi); }

/* ─── Đang diễn ra / Chơi với bạn / Xếp hạng ───── */
.hp-now {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  margin-top: 96px;
}
@media (min-width: 1100px) { .hp-now { grid-template-columns: 1fr 1.25fr 1fr; gap: 48px; } }
.hp-now > div { border-top: 1px solid var(--hp-line); padding-top: 20px; }

.hp-h2 {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
  font-size: 1.15rem; font-weight: 800; letter-spacing: -.01em;
}
.hp-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--hp-red); flex: none; display: none; }
.hp-live.is-live .hp-dot { display: block; } /* chỉ hiện khi thật sự nhận được dữ liệu trực tiếp */
.hp-live-text { margin-bottom: 18px; font-size: 1.05rem; }
.hp-live-text strong { font-weight: 800; font-variant-numeric: tabular-nums; }

.hp-steps, .hp-rank { list-style: none; }
.hp-steps { counter-reset: hp-step; max-width: 68ch; }
.hp-steps li {
  counter-increment: hp-step;
  position: relative;
  padding-left: 36px;
  margin-bottom: 12px;
  color: #c9c3b8;
}
.hp-steps li::before {
  content: counter(hp-step);
  position: absolute; left: 0; top: 1px;
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(216,166,96,.55);
  color: var(--hp-wood);
  font-size: .8rem; font-weight: 600;
}
.hp-note { margin-top: 14px; font-size: .9rem; color: var(--hp-muted); }

.hp-rank { counter-reset: hp-rank; margin-bottom: 14px; }
.hp-rank li {
  counter-increment: hp-rank;
  display: flex; align-items: baseline; gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--hp-line);
}
.hp-rank li::before { content: counter(hp-rank); width: 1.2em; color: var(--hp-muted); font-variant-numeric: tabular-nums; }
.hp-rank .hp-rank-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.hp-rank .hp-rank-pts { color: var(--hp-muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
.hp-rank li.hp-rank-empty { color: var(--hp-muted); border-bottom: 0; }
.hp-rank li.hp-rank-empty::before { content: none; }
.hp-link { color: var(--hp-wood); text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
.hp-link:hover { color: var(--hp-wood-hi); }

/* ─── Luật nhanh ───────────────────────────────── */
.hp-rules { margin-top: 96px; }
.hp-tabs {
  display: flex; flex-wrap: wrap; gap: 4px 24px;
  margin: 4px 0 24px;
  border-bottom: 1px solid var(--hp-line);
}
.hp-tab {
  padding: 10px 0;
  margin-bottom: -1px;
  background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--hp-muted);
  font-family: inherit; font-size: 1rem; font-weight: 600; line-height: 1.4;
}
.hp-tab:hover { color: var(--hp-paper); }
.hp-tab[aria-selected="true"] { color: var(--hp-paper); border-bottom-color: var(--hp-wood); }

/* ─── Khoảnh khắc chuyển động duy nhất: nước đi cuối vào chỗ ─── */
.hp-slide {
  animation: hp-slide .75s cubic-bezier(.2,.7,.2,1) both;
  animation-delay: calc(.35s + var(--i, 0) * .15s);
}
@keyframes hp-slide { from { transform: translate(var(--dx), var(--dy)); } to { transform: none; } }

.hp-drop {
  transform-box: fill-box; transform-origin: center;
  animation: hp-drop .45s cubic-bezier(.2,.7,.2,1) both;
  animation-delay: calc(.5s + var(--i, 0) * .15s);
}
@keyframes hp-drop { from { opacity: 0; transform: scale(1.4); } to { opacity: 1; transform: none; } }

.hp-ink {
  stroke-dasharray: 1; stroke-dashoffset: 1;
  animation: hp-ink .6s ease-out forwards;
  animation-delay: calc(.5s + var(--i, 0) * .15s);
}
@keyframes hp-ink { to { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
  .hp-slide, .hp-drop, .hp-ink { animation: none; stroke-dashoffset: 0; }
  .hp-board { transition: none; }
}

/* ─── Màn hình nhỏ ─────────────────────────────── */
@media (max-width: 768px) {
  .hp { padding: 76px 16px 72px; }  /* chừa chỗ cho nút menu cố định góc trên */
  .hp-lede { font-size: 1rem; }
  .hp-boards { margin-top: 32px; }
  .hp-now, .hp-rules { margin-top: 64px; }
}
@container (max-width: 559px) {
  .hp-game { display: grid; grid-template-columns: 112px 1fr; gap: 16px; align-items: start; }
  .hp-game-name { margin-top: 0; font-size: 1.15rem; }
  .hp-game-desc { font-size: .875rem; line-height: 1.5; }
  .hp-game-actions { padding-top: 10px; gap: 6px; }
  .hp-game-actions .hp-btn { flex: 1 1 auto; min-height: 44px; padding: 6px 10px; font-size: .85rem; }
}

/* Vùng chạm 44px cho link và tab chữ */
.hp-link { display: inline-flex; align-items: center; min-height: 44px; }
.hp-tab { min-height: 44px; min-width: 44px; }

/* ═══════════════════════════════════════════════════
   Bản nâng cấp: mở đầu có lời mời, bàn cờ nghiêng 3D, các khối nội dung,
   hiện dần khi cuộn. Mọi chuyển động tắt khi bật giảm chuyển động.
═══════════════════════════════════════════════════ */

/* ─── Mở đầu ─── */
.hp-hero { position: relative; isolation: isolate; }
.hp-glow {
  position: absolute; inset: -72px -48px auto; height: 560px; z-index: -1; pointer-events: none;
  background:
    radial-gradient(420px 300px at var(--mx, 30%) var(--my, 30%), rgba(216,166,96,.16), transparent 70%),
    radial-gradient(700px 360px at 80% 0%, rgba(194,59,44,.10), transparent 70%);
  transition: background-position .2s ease;
}
.hp-glow::after { /* lưới giao điểm như mặt bàn cờ, mờ dần xuống dưới */
  content: ''; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(239,232,218,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(239,232,218,.05) 1px, transparent 1px);
  background-size: 48px 48px; background-position: -1px -1px;
  mask-image: radial-gradient(ellipse 70% 80% at 30% 20%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 80% at 30% 20%, #000 20%, transparent 75%);
}
.hp-title-2 { display: block; color: var(--hp-wood); } /* ngắt dòng cố định: chiều cao tiêu đề không đổi khi font tải xong (tránh xê dịch bố cục) */
.hp-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.hp-btn-lg { min-height: 48px; padding: 12px 22px; font-size: 1rem; border-radius: 10px; }
.hp-btn-main.hp-btn-lg { box-shadow: 0 10px 28px -12px rgba(216,166,96,.7); }
.hp-facts { display: flex; flex-wrap: wrap; gap: 8px 28px; list-style: none; margin-top: 28px; font-size: .95rem; color: var(--hp-muted); }
.hp-facts strong { color: var(--hp-paper); font-weight: 800; font-size: 1.15rem; margin-right: 4px; font-variant-numeric: tabular-nums; }

/* ─── Bàn cờ: nghiêng theo con trỏ, có ánh sáng lướt ─── */
.hp-boards { perspective: 1200px; }
.hp-board { position: relative; transform-style: preserve-3d; transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .35s cubic-bezier(.2,.7,.2,1), box-shadow .2s ease; will-change: transform; }
.hp-game.is-tilting .hp-board { transition: transform .08s linear, box-shadow .2s ease; }
.hp-board-glare {
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .25s ease;
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 50%), rgba(255,255,255,.22), transparent 55%);
}
.hp-game:hover .hp-board-glare { opacity: 1; }
.hp-game-guide { display: inline-flex; align-items: center; min-height: 44px; margin-top: 4px; font-size: .9rem; color: var(--hp-muted); text-decoration: underline; text-underline-offset: 3px; }
.hp-game-guide:hover { color: var(--hp-wood-hi); }

/* ─── Khối nội dung chung ─── */
.hp-why, .hp-learn, .hp-faq { margin-top: 112px; }
.hp-sec-head { max-width: 640px; margin-bottom: 32px; }
.hp-h2-lg { font-size: clamp(1.6rem, 3vw, 2.1rem); letter-spacing: -.02em; margin-bottom: 8px; }
.hp-sec-lede { color: var(--hp-muted); font-size: 1.05rem; }
.hp-now > div { transition: border-color .2s ease; }

/* Vì sao chơi ở ChoiCo */
.hp-features { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--hp-line); border: 1px solid var(--hp-line); border-radius: 14px; overflow: hidden; }
.hp-feature { position: relative; padding: 28px 28px 32px; background: #0b1019; transition: background-color .25s ease; }
.hp-feature:hover { background: #101725; }
.hp-feature-ic { color: var(--hp-wood); margin-bottom: 16px; }
.hp-feature-title { font-size: 1.1rem; font-weight: 700; color: var(--hp-paper); margin-bottom: 6px; }
.hp-feature-text { color: #b9b3a8; font-size: .95rem; line-height: 1.6; }

/* Học chơi */
.hp-learn-grid { display: grid; grid-template-columns: 1fr; gap: 24px; margin-bottom: 16px; }
@media (min-width: 1100px) { .hp-learn-grid { grid-template-columns: 300px 1fr; align-items: start; } }
.hp-guides { list-style: none; border: 1px solid var(--hp-line); border-radius: 14px; overflow: hidden; }
.hp-guides li + li { border-top: 1px solid var(--hp-line); }
.hp-guides a { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; padding: 0 20px; color: var(--hp-paper); font-weight: 600; text-decoration: none; transition: background-color .2s ease, color .2s ease; }
.hp-guides a:hover { background: rgba(216,166,96,.08); color: var(--hp-wood-hi); }
.hp-guides svg { color: var(--hp-wood); transition: transform .2s ease; }
.hp-guides a:hover svg { transform: translateX(4px); }
.hp-posts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.hp-posts > div { display: flex; }
.hp-posts .ch-card-link { background: #0b1019; }

/* Câu hỏi thường gặp */
.hp-faq-list { max-width: 820px; margin-bottom: 16px; }
.hp-qa { border-bottom: 1px solid var(--hp-line); }
.hp-qa summary { display: flex; justify-content: space-between; gap: 16px; align-items: center; min-height: 60px; cursor: pointer; list-style: none; font-weight: 700; font-size: 1.05rem; color: var(--hp-paper); }
.hp-qa summary::-webkit-details-marker { display: none; }
.hp-qa summary::after { content: '+'; flex: none; font-size: 1.4rem; line-height: 1; color: var(--hp-wood); transition: transform .2s ease; }
.hp-qa[open] summary::after { transform: rotate(45deg); }
.hp-qa p { padding: 0 32px 20px 0; color: #b9b3a8; }

/* Lời mời cuối trang */
.hp-final {
  margin-top: 112px; padding: 56px 40px; text-align: center; border-radius: 18px;
  background: radial-gradient(600px 240px at 50% 0%, rgba(216,166,96,.18), transparent 70%), #0b1019;
  border: 1px solid rgba(216,166,96,.25);
}
.hp-final-title { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 800; letter-spacing: -.03em; color: var(--hp-paper); }
.hp-final .hp-cta { justify-content: center; }

/* ─── Hiện dần khi cuộn (chỉ khi JS bật lớp .hp-anim) ─── */
.hp-anim [data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s cubic-bezier(.2,.7,.2,1); transition-delay: calc(var(--d, 0) * 90ms); }
.hp-anim [data-reveal].is-in { opacity: 1; transform: none; }

/* Chữ mở đầu hiện ngay, không hiệu ứng: đây là phần tử LCP trên điện thoại,
   ẩn rồi hiện dần (do JS cuối trang bật) làm LCP chậm và chữ nháy trên máy yếu */

@media (max-width: 768px) {
  .hp-why, .hp-learn, .hp-faq, .hp-final { margin-top: 72px; }
  .hp-final { padding: 40px 20px; }
  .hp-glow { inset: -76px -16px auto; height: 420px; }
  .hp-cta .hp-btn-lg { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) {
  .hp-anim [data-reveal] { opacity: 1; transform: none; transition: none; }
  .hp-board { transform: none !important; transition: none; }
  .hp-board-glare, .hp-feature, .hp-guides a, .hp-guides svg, .hp-qa summary::after { transition: none; }
}
@media (max-width: 1100px) { .hp-features { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .hp-features { grid-template-columns: 1fr; } }

/* ─── Cờ úp: khối giới thiệu dưới 4 bàn cờ ─── */
.hp-up {
  display: grid; grid-template-columns: 180px 1fr; gap: 28px; align-items: center;
  margin-top: 48px; padding: 24px; border-radius: 16px;
  background: linear-gradient(110deg, rgba(216,166,96,.12), rgba(216,166,96,.03)); border: 1px solid rgba(216,166,96,.3);
}
.hp-up-board { display: block; aspect-ratio: 1; border-radius: 8px; overflow: hidden; box-shadow: 0 16px 28px -16px rgba(0,0,0,.9); }
.hp-up-board svg { display: block; width: 100%; height: 100%; }
.hp-up-tag { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--hp-red); color: #fff; font-size: .8rem; font-weight: 700; }
.hp-up .hp-game-name { margin-top: 8px; }
.hp-up .hp-game-desc { max-width: 62ch; }
.hp-up .hp-game-actions { padding-top: 14px; align-items: center; }
@media (max-width: 640px) { .hp-up { grid-template-columns: 96px 1fr; gap: 16px; padding: 16px; } }
/* Thế của hôm nay: cùng khung với khối cờ úp, đặt bàn bên phải để hai khối không lặp hình */
.hp-the { margin-top: 20px; grid-template-columns: 1fr 180px; background: linear-gradient(250deg, rgba(192,57,43,.12), rgba(192,57,43,.03)); border-color: rgba(192,57,43,.3); }
.hp-the .hp-up-board { order: 2; }
@media (max-width: 640px) { .hp-the { grid-template-columns: 1fr 96px; } }
