/* ============================================================
   public.css - Shared styles across all pages
   ============================================================ */

:root {
  --primary: #102b6a;
  --primary-light: #1a3f8f;
  --primary-hover: #0d224f;
  --navy: #102b6a;
  --navy-deep: #08183c;
  --gold: #fdb933;
  --gold-dark: #f5a623;
  --orange: #f15a22;
  --red: #e74c3c;
  --red-dark: #c0392b;
  --purple: #7b2d8e;
  --green: #27ae60;
  --white: #ffffff;
  --bg: #eef3fb;
  --bg-light: #f4f6fb;
  --bg-body: #f5f6fa;
  --text: #1f2a44;
  --text-soft: #60708c;
  --text-dark: #1a1a2e;
  --text-default: #333333;
  --text-muted: #6b7280;
  --text-light: #999999;
  --border: rgba(16, 43, 106, 0.1);
  --border-light: #e5e7eb;
  --border-lighter: #f0f0f0;
  --shadow: 0 20px 48px rgba(16, 43, 106, 0.08);
  --shadow-soft: 0 12px 26px rgba(16, 43, 106, 0.08);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --radius-sm: 4px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --max-width: 1480px;
  --font-main: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
}

/* ----------------------------------------------------------
   1. Reset & Base
   ---------------------------------------------------------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background:
    radial-gradient(circle at top left, rgba(253, 185, 51, 0.08), transparent 24%),
    radial-gradient(circle at top right, rgba(16, 43, 106, 0.09), transparent 20%),
    linear-gradient(180deg, #f9fbff 0%, #edf2fb 42%, #eef3fb 100%);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s;
}

ul {
  list-style: none;
}

img {
  max-width: 100%;
  display: block;
}

button,
input,
select {
  font: inherit;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ----------------------------------------------------------
   2. Topbar (unified header)
   ---------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: linear-gradient(90deg, rgba(8, 24, 60, .98), rgba(16, 43, 106, .98) 45%, rgba(15, 70, 126, .98));
  box-shadow: 0 14px 40px rgba(8, 24, 60, .28);
}

.topbar::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(253, 185, 51, .95), transparent);
}

.topbar__inner {
  width: min(var(--max-width), calc(100% - 48px));
  margin: 0 auto;
  min-height: 82px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.topbar__logo {
  width: 200px;
  height: auto;
}

.topbar__nav {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.topbar__nav-link {
  position: relative;
  padding: 12px 18px;
  border-radius: 999px;
  color: rgba(255, 255, 255, .82);
  font-size: 15px;
  transition: .24s ease;
}

.topbar__nav-link:hover,
.topbar__nav-link.is-active {
  color: var(--white);
  background: rgba(255, 255, 255, .08);
}

.topbar__nav-link.is-active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 24px;
  height: 3px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: linear-gradient(90deg, #ffd16a, var(--gold));
}

.topbar__user,
.topbar__guest,
.topbar__logged {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar__profile {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 999px;
  padding: 4px 8px;
  transition: .24s ease;
}

.topbar__profile:hover {
  background: rgba(255, 255, 255, .08);
}

.topbar__btn {
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  cursor: pointer;
  transition: .24s ease;
}

.topbar__btn--ghost {
  color: var(--white);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .22);
}

.topbar__btn--primary {
  color: var(--navy-deep);
  font-weight: 700;
  background: linear-gradient(135deg, #ffd26b, var(--gold));
  box-shadow: 0 10px 22px rgba(253, 185, 51, .24);
}

.topbar__btn--logout {
  color: rgba(255, 255, 255, .82);
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .14);
}

.topbar__avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid rgba(253, 185, 51, .7);
  object-fit: cover;
}

.topbar__meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.topbar__uname {
  display: flex;
  justify-content: center;
  color: var(--white);
  font-weight: 700;
  font-size: 14px;
}

.topbar__ubadge {
  display: inline-flex;
  width: fit-content;
  padding: 3px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffd26b, var(--gold));
  color: var(--navy-deep);
  font-size: 12px;
  font-weight: 700;
}

/* ----------------------------------------------------------
   3. Site Footer (unified footer)
   ---------------------------------------------------------- */
.site-footer {
  width: min(var(--max-width), calc(100% - 48px));
  margin: 0 auto;
  margin-top: 28px;
}

.site-footer__inner {
  padding: 24px 28px;
  border-radius: 28px;
  border: 1px solid rgba(16, 43, 106, .08);
  background: linear-gradient(135deg, rgba(8, 24, 60, .98), rgba(16, 43, 106, .96) 55%, rgba(17, 74, 126, .96));
}

.site-footer__logo {
  width: 220px;
}

.site-footer__inner p {
  margin: 16px 0 0;
  color: rgba(255, 255, 255, .8);
  line-height: 1.8;
}

.site-footer__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 18px;
  color: rgba(255, 255, 255, .56);
  font-size: 12px;
}

.site-footer__meta a {
  color: rgba(255, 255, 255, .56);
}

.site-footer__meta a:hover {
  color: rgba(255, 255, 255, .86);
}

/* ----------------------------------------------------------
   4. Ball Styles (unified ball system)
   ---------------------------------------------------------- */
.ball {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--white);
  font-size: 14px;
  font-weight: 800;
}

.ball--compact {
  width: 28px;
  height: 28px;
  font-size: 12px;
  padding: 0 8px;
}

.ball--red {
  background: linear-gradient(180deg, #ff6d76, #f24858);
}

.ball--blue {
  background: linear-gradient(180deg, #5b96ff, #306ee2);
}

.ball--orange {
  background: linear-gradient(180deg, #ffb35f, #ff8c1a);
}

.ball--green {
  background: linear-gradient(180deg, #45d59e, #1ea871);
}

.ball--purple {
  background: linear-gradient(180deg, #a07cff, #7c57ef);
}

.ball--gold {
  background: linear-gradient(180deg, #ffd35a, #f1a61a);
}

.ball--teal {
  background: linear-gradient(180deg, #40d4ce, #119f9a);
}

.ball--violet {
  background: linear-gradient(180deg, #c68cff, #8f57ea);
}

.ball--empty {
  background: #dbe4f2;
  color: #7d8ba4;
}

/* Legacy ball styles (compat) */
.red-q {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f15a22, #e74c3c);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  margin: 1px 2px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  box-shadow: 0 2px 6px rgba(241, 90, 34, 0.35);
}

.bule-q {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #102b6a, #3b6fd4);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  margin: 1px 2px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  box-shadow: 0 2px 6px rgba(16, 43, 106, 0.35);
}

.table-text {
  font-size: 14px;
  color: #333;
}

.table-img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
}

/* ----------------------------------------------------------
   5. Main Container
   ---------------------------------------------------------- */
.cxz-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* ----------------------------------------------------------
   6. Breadcrumb
   ---------------------------------------------------------- */
.cxz-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 48px;
  padding: 14px 0 16px;
  color: #6b7280;
  font-size: 14px;
  line-height: 20px;
}

.cxz-breadcrumb a {
  color: #5f6f86;
  transition: color 0.2s;
}

.cxz-breadcrumb a:hover {
  color: var(--primary);
}

.cxz-breadcrumb .sep {
  margin: 0 1px;
  color: #b8c1cf;
}

.cxz-breadcrumb span:not(.sep) {
  color: #34425a;
}

/* ----------------------------------------------------------
   7. Lottery Tabs
   ---------------------------------------------------------- */
.cxz-lottery-tabs {
  display: flex;
  gap: 8px;
  padding: 16px 0;
  flex-wrap: wrap;
}

.cxz-lottery-tab {
  padding: 8px 22px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
  background: #fff;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  transition: all 0.25s;
  white-space: nowrap;
}

.cxz-lottery-tab:hover {
  color: #102b6a;
  border-color: #102b6a;
  background: #f4f6fb;
}

.cxz-lottery-tab.active {
  color: #fff;
  background: #102b6a;
  border-color: #102b6a;
  box-shadow: 0 2px 8px rgba(16, 43, 106, 0.25);
}

/* ----------------------------------------------------------
   8. Section Header
   ---------------------------------------------------------- */
.cxz-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 2px solid #f0f0f0;
  margin-bottom: 16px;
}

.cxz-section-title {
  font-size: 18px;
  font-weight: 700;
  color: #1a1a2e;
  position: relative;
  padding-left: 14px;
}

.cxz-section-title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 20px;
  background: linear-gradient(180deg, #102b6a, #fdb933);
  border-radius: 2px;
}

.cxz-section-more {
  font-size: 14px;
  color: #6b7280;
  cursor: pointer;
  transition: color 0.2s;
}

.cxz-section-more:hover {
  color: #102b6a;
}

/* ----------------------------------------------------------
   9. Data Tables
   ---------------------------------------------------------- */
.cxz-table-box {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  margin-bottom: 20px;
}

.cxz-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
}

.cxz-table-title {
  font-size: 16px;
  font-weight: 700;
  color: #1a1a2e;
}

.cxz-data-table {
  width: 100%;
  border-collapse: collapse;
}

.cxz-data-table thead {
  background: #f4f6fb;
}

.cxz-data-table th {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid #e5e7eb;
}

.cxz-data-table td {
  padding: 12px 16px;
  font-size: 14px;
  color: #333;
  border-bottom: 1px solid #f0f0f0;
}

.cxz-data-table tbody tr {
  transition: background 0.2s;
}

.cxz-data-table tbody tr:hover {
  background: #f9fafb;
}

/* ----------------------------------------------------------
   10. Pagination
   ---------------------------------------------------------- */
.cxz-pagination {
  padding: 20px;
  text-align: center;
}

/* ----------------------------------------------------------
   11. CommonUtil Compat (ads & links)
   ---------------------------------------------------------- */
.PublicAdvertising {
  background: #fff;
  padding: 20px 0;
}

.PublicAdvertisingUl {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.PublicAdvertisingLi {
  display: inline-block;
}

.PublicAdvertisingLi a {
  display: inline-block;
  padding: 4px 12px;
  font-size: 13px;
  color: #6b7280;
  border-radius: 4px;
  transition: all 0.2s;
  background: #f4f6fb;
}

.PublicAdvertisingLi a:hover {
  color: #102b6a;
  background: #eef1f8;
}

.PublicAdvertisingImg {
  display: block;
  max-width: 100%;
  border-radius: 6px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.PublicAdvertisingImg:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 16px rgba(16, 43, 106, 0.1);
}

.FooterPublicFriendship {
  background: #fff;
  padding: 16px 0;
  border-top: 1px solid #e5e7eb;
}

.FooterPublicFriendship .other-box {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.FooterPublicFriendship .link-box {
  margin-bottom: 12px;
}

.FooterPublicFriendship .other-title {
  font-size: 14px;
  font-weight: 600;
  color: #1a1a2e;
  margin-bottom: 8px;
  padding-left: 10px;
  border-left: 3px solid #102b6a;
}

.FooterPublicFriendship .link-listUl {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.FooterPublicFriendship .link-listLi {
  display: inline-block;
}

.FooterPublicFriendship .link-listLi a {
  display: inline-block;
  padding: 4px 12px;
  font-size: 13px;
  color: #6b7280;
  border-radius: 4px;
  transition: all 0.2s;
  background: #f4f6fb;
}

.FooterPublicFriendship .link-listLi a:hover {
  color: #102b6a;
  background: #eef1f8;
}

.FooterPublicAdvertising {
  background: #f4f6fb;
  padding: 20px 0;
}

/* ----------------------------------------------------------
   12. Gotop Button
   ---------------------------------------------------------- */
.gotop {
  position: fixed;
  right: 28px;
  bottom: 28px;
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 50%;
  color: var(--navy-deep);
  background: linear-gradient(135deg, #ffd26b, var(--gold));
  box-shadow: 0 16px 28px rgba(253, 185, 51, .3);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: .24s ease;
  z-index: 900;
}

.gotop.is-visible {
  opacity: 1;
  visibility: visible;
}

/* ----------------------------------------------------------
   13. Modal (history query)
   ---------------------------------------------------------- */
.modal-mask {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 30px;
  background: rgba(4, 15, 36, .58);
  backdrop-filter: blur(8px);
  z-index: 1100;
}

.modal-mask.is-open {
  display: flex;
}

.modal-box {
  width: min(1080px, 100%);
  max-height: 82vh;
  overflow: hidden;
  border-radius: 28px;
  background: #fdfefe;
  box-shadow: 0 30px 80px rgba(4, 15, 36, .35);
}

.modal-box__head {
  padding: 22px 24px;
  color: var(--white);
  background: linear-gradient(90deg, #08183c, #102b6a, #164d86);
}

.modal-box__head strong {
  display: block;
  font-size: 24px;
}

.modal-box__head p {
  margin: 6px 0 0;
  color: rgba(255, 255, 255, .72);
  font-size: 13px;
}

.modal-box__head button {
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
  color: var(--white);
  font-size: 28px;
  cursor: pointer;
}

.modal-box__filter {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 24px;
  background: #f3f7fe;
}

.modal-box__filter span {
  color: var(--text-soft);
}

.modal-box__filter select,
.modal-input {
  height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid rgba(16, 43, 106, .12);
  background: var(--white);
}

.modal-box__body {
  max-height: calc(82vh - 146px);
  overflow: auto;
}

.modal-table {
  width: 100%;
  border-collapse: collapse;
}

.modal-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 14px 16px;
  background: #eef4fe;
  color: var(--navy);
  font-size: 13px;
  text-align: left;
}

.modal-table td {
  padding: 14px 16px;
  border-top: 1px solid rgba(16, 43, 106, .08);
  color: var(--text);
  font-size: 14px;
}

.modal-table .history-code {
  color: var(--navy);
  font-weight: 700;
  font-family: Consolas, "SFMono-Regular", monospace;
}

.modal-table .is-empty {
  text-align: center;
  color: var(--text-soft);
  padding: 28px 16px;
}

/* ----------------------------------------------------------
   14. Scrollbar
   ---------------------------------------------------------- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: rgba(16, 43, 106, .2);
  border-radius: 999px;
  transition: background 0.2s;
}

::-webkit-scrollbar-thumb:hover {
  background: #999;
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(16, 43, 106, .2) #f1f1f1;
}

/* ----------------------------------------------------------
   15. Responsive
   ---------------------------------------------------------- */
@media (max-width: 1024px) {
  .topbar__inner {
    min-height: 68px;
    gap: 16px;
  }

  .topbar__nav-link {
    padding: 10px 14px;
    font-size: 14px;
  }

  .cxz-main {
    padding: 16px;
  }

  .container {
    padding: 0 16px;
  }

  .PublicAdvertisingUl {
    padding: 0 16px;
  }
}

@media (max-width: 768px) {
  .topbar__inner {
    flex-wrap: wrap;
    min-height: auto;
    padding: 10px 12px;
    gap: 8px;
  }

  .topbar__nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
    gap: 4px;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .topbar__nav-link {
    padding: 6px 14px;
    font-size: 13px;
  }

  .topbar__btn {
    padding: 8px 14px;
    font-size: 13px;
  }

  .cxz-main {
    padding: 12px;
  }

  .cxz-section-title {
    font-size: 16px;
  }

  .cxz-lottery-tabs {
    gap: 6px;
    padding: 12px 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
  }

  .cxz-lottery-tab {
    padding: 6px 16px;
    font-size: 13px;
  }

  .cxz-data-table th,
  .cxz-data-table td {
    padding: 10px 8px;
    font-size: 13px;
  }

  .red-q,
  .bule-q {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }

  .ball {
    min-width: 28px;
    height: 28px;
    font-size: 12px;
    padding: 0 8px;
  }

  .ball--compact {
    min-width: 24px;
    height: 24px;
    font-size: 11px;
    padding: 0 6px;
  }

  .PublicAdvertisingUl {
    padding: 0 12px;
    gap: 6px;
  }

  .PublicAdvertisingLi a {
    padding: 3px 8px;
    font-size: 12px;
  }

  .container {
    padding: 0 12px;
  }

  .cxz-breadcrumb {
    font-size: 13px;
  }

  .cxz-pagination {
    padding: 16px 12px;
  }

  .site-footer__inner {
    padding: 18px 16px;
    border-radius: 18px;
  }
}
