/* Website MU OpenMU — giao diện tối, đỏ rượu vang, chữ sáng. */
* { box-sizing: border-box; }
body { margin: 0; background: #120a0a; color: #f3e9e2; font-family: "Segoe UI", Arial, sans-serif; line-height: 1.55; }
a { color: #ffb347; }
a:hover { color: #ffd28a; }
header.top { background: linear-gradient(180deg, #3a0d0d, #200606); border-bottom: 2px solid #8b0000; padding: 12px 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
header.top .logo { font-size: 26px; font-weight: 800; color: #ffd700; text-decoration: none; letter-spacing: 1px; }
header.top .logo small { display: block; font-size: 12px; color: #d8b4a0; font-weight: 400; letter-spacing: 0; }
nav.main { display: flex; flex-wrap: wrap; gap: 4px; margin-left: auto; }
nav.main a { color: #f3e9e2; text-decoration: none; padding: 8px 12px; border-radius: 6px; font-weight: 600; }
nav.main a:hover, nav.main a.active { background: #8b0000; color: #fff; }
main { max-width: 1020px; margin: 0 auto; padding: 24px 16px 60px; }
h1 { color: #ffd700; margin-top: 0; }
h2 { color: #ffb347; border-bottom: 1px solid #5a2a2a; padding-bottom: 6px; }
h3 { color: #ffd28a; }
.card { background: #1e1111; border: 1px solid #5a2a2a; border-radius: 10px; padding: 16px 20px; margin: 16px 0; }
.notice { background: #2a1a08; border: 1px solid #b8860b; border-radius: 8px; padding: 12px 16px; margin: 16px 0; }
.error { background: #3a0d0d; border: 1px solid #c0392b; border-radius: 8px; padding: 12px 16px; margin: 16px 0; }
.ok { background: #0d2a12; border: 1px solid #27ae60; border-radius: 8px; padding: 12px 16px; margin: 16px 0; }
.status-online { color: #2ecc71; font-weight: 700; }
.status-offline { color: #e74c3c; font-weight: 700; }
table { border-collapse: collapse; width: 100%; margin: 12px 0; }
th, td { border: 1px solid #5a2a2a; padding: 8px 10px; text-align: left; }
th { background: #3a0d0d; color: #ffd700; }
tr:nth-child(even) td { background: #1a0e0e; }
.btn { display: inline-block; background: #8b0000; color: #fff; border: none; padding: 10px 22px; border-radius: 6px; font-size: 16px; font-weight: 700; cursor: pointer; text-decoration: none; }
.btn:hover { background: #a80000; color: #fff; }
.btn-secondary { background: #444; }
.btn-small { padding: 6px 12px; font-size: 14px; margin: 2px; }
.inline-form { display: inline; }
input[type=text], input[type=password], input[type=email], select { width: 100%; max-width: 420px; padding: 10px; margin: 6px 0 14px; border-radius: 6px; border: 1px solid #5a2a2a; background: #2a1414; color: #f3e9e2; font-size: 15px; }
label { font-weight: 600; display: block; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.tag { display: inline-block; background: #8b0000; color: #fff; border-radius: 4px; padding: 2px 8px; font-size: 12px; margin-right: 6px; }
.muted { color: #c9a89a; font-size: 14px; }
footer { text-align: center; color: #c9a89a; padding: 20px; border-top: 1px solid #5a2a2a; font-size: 14px; }
.search-box { width: 100%; max-width: 420px; }
ul.tight li { margin-bottom: 6px; }
code { background: #2a1414; padding: 2px 6px; border-radius: 4px; }

/* Hero trang chủ (Part 1) — dùng chung tông tối/đỏ/gold hiện có. */
.hero { background: linear-gradient(180deg, #2a0d0d, #1e1111); border: 1px solid #5a2a2a; border-radius: 12px; padding: 28px 24px 20px; margin: 4px 0 20px; text-align: center; }
.hero h1 { font-size: 40px; margin: 0 0 8px; letter-spacing: 1px; }
.hero-tagline { color: #ffd700; font-weight: 700; font-size: 18px; margin: 0 0 8px; }
.hero-sub { color: #f3e9e2; max-width: 640px; margin: 0 auto 14px; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 0 0 16px; }
.hero-chip { background: #2a1414; border: 1px solid #5a2a2a; border-radius: 6px; padding: 4px 12px; font-size: 14px; color: #c9a89a; }
.hero-chip strong { color: #ffd700; }
.hero-cta { margin: 0 0 16px; display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.btn-hero { padding: 12px 32px; font-size: 18px; }
.hero-status { border-top: 1px solid #5a2a2a; padding-top: 12px; font-size: 14px; }

/* --- Trang chủ 2 cột + sidebar (Part 2) --- */
.home-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.home-main { min-width: 0; }
.home-main h1 { margin-top: 0; }
.home-sidebar { position: sticky; top: 16px; align-self: start; }
.sidebar-block { margin: 0 0 14px; }
.sidebar-block h3 { margin-top: 0; }
.sidebar-top10 { list-style: none; margin: 0; padding: 0; }
.sidebar-top10 li { display: flex; gap: 8px; align-items: baseline; padding: 5px 0; border-bottom: 1px solid #3a1e1e; }
.sidebar-top10 li:last-child { border-bottom: none; }
.sidebar-rank { display: inline-block; min-width: 22px; font-weight: 700; color: #ffd700; }
.sidebar-top1 .sidebar-rank { color: #ffd700; }
.sidebar-top2 .sidebar-rank { color: #c0c0c0; }
.sidebar-top3 .sidebar-rank { color: #cd7f32; }
.sidebar-reset { margin-left: auto; color: #c9a89a; font-size: 13px; white-space: nowrap; }
.sidebar-events { list-style: none; margin: 0; padding: 0; }
.sidebar-events li { padding: 5px 0; border-bottom: 1px solid #3a1e1e; }
.sidebar-events li:last-child { border-bottom: none; }
@media (max-width: 900px) {
  .home-layout { grid-template-columns: 1fr; }
  .home-sidebar { position: static; }
}

/* Phần 3: tin tức, tab BXH, huy chương top 1-3 (table-wrap gộp ở Phần 5, không lặp). */
.news-list li { margin-bottom: 8px; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.tab { display: inline-block; padding: 8px 14px; border: 1px solid #5a2a2a; border-radius: 6px; text-decoration: none; font-weight: 600; }
.tab-active { background: #8b0000; color: #fff; border-color: #8b0000; }
.tab-disabled { color: #8a6f66; border-style: dashed; cursor: not-allowed; }
tr.rank-1 td { background: #3a2f08; }
tr.rank-2 td { background: #2a2a2e; }
tr.rank-3 td { background: #33200f; }
tr.rank-1 td:first-child { color: #ffd700; font-weight: 800; }
tr.rank-2 td:first-child { color: #d7d7d7; font-weight: 800; }
tr.rank-3 td:first-child { color: #e0a060; font-weight: 800; }

/* Trang Giới thiệu (/gioi-thieu) — phần 4 (khối .hero gốc giữ bản Phần 1, không lặp). */
.hero .tagline { font-size: 18px; color: #ffd28a; max-width: 720px; margin: 0 auto; }
.cta-row { margin-top: 18px; }
.cta-row .btn { margin: 4px; }
ol.timeline { list-style: none; counter-reset: step; padding-left: 0; }
ol.timeline li { counter-increment: step; margin-bottom: 12px; padding-left: 44px; position: relative; }
ol.timeline li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 28px; height: 28px; line-height: 28px; text-align: center; background: #8b0000; color: #fff; border-radius: 50%; font-weight: 700; }
@media (max-width: 640px) { .hero h1 { font-size: 26px; } .hero .tagline { font-size: 16px; } }

/* ===== Phần 5: Mobile responsive + nav nhóm (chèn thêm, 23/11/2026) ===== */

/* --- Bọc bảng cuộn ngang (dùng cho Bước 4; các bảng chưa bọc vẫn được
   Bước 1b bên dưới cứu bằng display:block) --- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 12px 0; }
.table-wrap table { margin: 0; }

/* --- Nhóm nav "Nạp & Dịch vụ": dropdown thuần CSS (desktop) --- */
nav.main .nav-group { position: relative; display: flex; }
nav.main .nav-group-title { white-space: nowrap; }
nav.main .nav-sub {
  display: none; position: absolute; top: 100%; left: 0; min-width: 210px;
  background: #200606; border: 1px solid #8b0000; border-radius: 0 0 8px 8px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .55); z-index: 50;
}
nav.main .nav-sub a { display: block; padding: 10px 14px; white-space: nowrap; }
nav.main .nav-group:hover .nav-sub,
nav.main .nav-group:focus-within .nav-sub { display: block; }

/* --- Nút hamburger: ẩn trên desktop --- */
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.nav-toggle-label { display: none; }

/* --- Hero / sidebar: CSS phòng thủ cho class mà phần 1–3 có thể thêm.
   Nếu các class này chưa tồn tại thì các rule dưới vô hại. --- */
.hero .btn { margin: 4px; }

/* ================= Breakpoint duy nhất: 768px ================= */
@media (max-width: 768px) {
  header.top { padding: 10px 12px; gap: 10px; }
  header.top .logo { font-size: 22px; }
  .nav-toggle-label {
    display: inline-flex; align-items: center; justify-content: center;
    margin-left: auto; font-size: 26px; line-height: 1; color: #ffd700;
    padding: 8px 12px; min-width: 48px; min-height: 44px;
    border: 1px solid #8b0000; border-radius: 6px; cursor: pointer;
    background: #200606;
  }
  nav.main { display: none; flex-direction: column; width: 100%; margin-left: 0; gap: 0; }
  #nav-toggle:checked ~ nav.main { display: flex; }
  nav.main a {
    display: block; width: 100%; padding: 12px 14px; min-height: 44px;
    border-top: 1px solid #5a2a2a; border-radius: 0;
  }
  nav.main .nav-group { display: block; width: 100%; }
  nav.main .nav-group-title { border-top: 1px solid #5a2a2a; }
  nav.main .nav-sub {
    display: block; position: static; min-width: 0; border: none;
    border-radius: 0; box-shadow: none; background: transparent;
  }
  nav.main .nav-sub a { padding-left: 28px; border-top: 1px solid #3a1a1a; }

  main { padding: 16px 12px 40px; }
  h1 { font-size: 24px; }
  .grid { grid-template-columns: 1fr; }
  .layout { grid-template-columns: 1fr !important; }
  .sidebar { order: 2; }
  .hero { padding: 20px 16px; text-align: center; }
  .hero h1 { font-size: 28px; }

  .cta-row .btn, .hero .btn {
    display: block; width: 100%; margin: 8px 0; text-align: center;
    min-height: 48px; padding: 13px 22px;
  }

  input[type=text], input[type=password], input[type=email], select { max-width: 100%; }

  table { display: block; overflow-x: auto; max-width: 100%; }
  th, td { white-space: nowrap; }

  /* BXH sau Part 3 chi con 6 cot: Hang(1) Nhan vat(2) Class(3) Cap(4) Reset(5) Guild(6)
     -> an cot Guild o nth-child(6); rule an cot Master (5) cu da bo. */
  .ranking-table th:nth-child(6), .ranking-table td:nth-child(6) { display: none; } /* Guild */
  .quests-table th:nth-child(4), .quests-table td:nth-child(4) { display: none; }   /* CP */
  .monsters-table th:nth-child(5), .monsters-table td:nth-child(5) { display: none; } /* Phòng thủ */
  .monsters-table th:nth-child(7), .monsters-table td:nth-child(7) { display: none; } /* Hồi sinh */
  .duel-table th:nth-child(7), .duel-table td:nth-child(7) { display: none; }         /* Cược */

  footer { padding: 16px 12px; }
}

/* Màn rất hẹp (<= 480px): BXH chỉ giữ Hạng / Nhân vật / Cấp / Reset */
@media (max-width: 480px) {
  .ranking-table th:nth-child(3), .ranking-table td:nth-child(3) { display: none; } /* Class */
}

/* BXH P1 — bảng Top PK dùng class riêng pk-ranking-table (8 cột):
   rule ẩn nth-child(6) của .ranking-table sẽ nhắm nhầm cột Cấp ở đây,
   nên ẩn đúng cột Guild (8) ở <=768px và cột Class (3) ở <=480px. */
@media (max-width: 768px) {
  .pk-ranking-table th:nth-child(8), .pk-ranking-table td:nth-child(8) { display: none; } /* Guild */
}
@media (max-width: 480px) {
  .pk-ranking-table th:nth-child(3), .pk-ranking-table td:nth-child(3) { display: none; } /* Class */
}
