/* =========================================================
   百乐象棋俱乐部 · Club Xiangqi Bera — Formal theme
   Palette from the logo: navy + brushed gold (+ silver edge)
   Red is used ONLY for the main call-to-action.
   ========================================================= */

@import url("https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@500;700&family=Noto+Sans+SC:wght@400;500&display=swap");

:root {
  /* ========================================================
     CXQB MASTER DESIGN TOKENS (全站统一视觉色彩与毛玻璃规范)
     在此处修改一次，全站三端（首页、教练端、校际端）自动同步！
     ======================================================== */

  /* 1. 页面极简暗夜蓝与棋盘微光背景 */
  --bg-page:            #040C17;                           /* 页面极深海蓝底色 */
  --grid-line:          rgba(241, 196, 15, 0.045);         /* 棋盘背景微金网格线 */
  --grid-size:          72px 72px;                         /* 棋盘网格统一尺寸 */

  /* 2. 顶栏导航与下拉大菜单 (Navigation & Mega Menu) */
  --top-color:          rgba(6, 23, 36, 0.92);             /* 顶栏深海蓝毛玻璃背景 */
  --top-blur:           16px;                              /* 顶栏毛玻璃模糊度 */
  --top-border:         rgba(255, 255, 255, 0.08);         /* 顶栏与菜单微光边框 */
  --mega-bg:            rgba(6, 23, 36, 0.78);            /* 下拉大菜单半透底色 */
  --mega-blur:          24px;                              /* 大菜单毛玻璃模糊度 */
  --backdrop-blur:      20px;                              /* 全屏背景遮罩模糊度 */
  --backdrop-bg:        rgba(0, 0, 0, 0.45);               /* 全屏背景遮罩半透黑 */

  /* 3. 毛玻璃卡片与表单 (Cards & Inputs) */
  --card-glass:         rgba(6, 23, 36, 0.72);             /* 磨砂玻璃卡片背景 */
  --card-glass-border:  rgba(255, 255, 255, 0.12);         /* 晶莹高光边框 */
  --card-glass-shadow:  0 25px 60px rgba(0, 0, 0, 0.6), 0 0 35px rgba(241, 196, 15, 0.06);
  --card-radius:        24px;                              /* 统一大圆角 */

  --input-glass-bg:     rgba(255, 255, 255, 0.05);         /* 半透输入框背景 */
  --input-glass-border: rgba(255, 255, 255, 0.12);         /* 输入框高光边框 */
  --input-glass-blur:   8px;                               /* 输入框微磨砂 */
  --input-focus-glow:   rgba(241, 196, 15, 0.5);           /* 输入框激活高亮边框 */

  /* 4. 品牌核心点缀色 (Gold & Red CTA) */
  --badge-gold-bg:      #F1C40F;                           /* 尊荣纯金徽章背景 */
  --badge-gold-text:    #0A1929;                           /* 金徽章深色文字 */
  --gold-hover:         #F1C40F;                           /* 鼠标悬停高光金 */
  
  --btn-primary-bg:     linear-gradient(135deg, #E63946 0%, #D90429 100%); /* 统一主操作渐变红 */
  --btn-primary-shadow: 0 8px 25px rgba(230, 57, 70, 0.4); /* 红色按钮微光投影 */
  --btn-primary-hover:  linear-gradient(135deg, #F04856 0%, #E81035 100%); /* 悬停渐变微亮 */

  /* 5. 分段控制器语言切换 (Segmented Controls) */
  --seg-bg:             rgba(255, 255, 255, 0.08);         /* 分段器胶囊底槽 */
  --seg-active-bg:      rgba(255, 255, 255, 0.95);         /* 激活语言纯白按钮 */
  --seg-active-color:   #111111;                           /* 激活文字深黑 */
  --seg-text-color:     rgba(255, 255, 255, 0.6);          /* 未激活文字半透白 */

  /* 6. 统一字体规范 (Typography) */
  --font-serif:         'Noto Serif SC', 'Songti SC', 'SimSun', serif;
  --font-sans:          -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Noto Sans SC', sans-serif;

  /* Colour */
  --navy-950: #07101e;   /* page */
  --navy-900: #0b1a2f;   /* cards */
  --navy-800: #112440;   /* raised / hover */
  --gold:      #c9a24b;  /* accent, borders */
  --gold-soft: #e3c97f;  /* headings accent */
  --silver:    #b9c0ca;  /* secondary line */
  --ink:       #f3efe4;  /* main text (warm white from logo bg) */
  --ink-dim:   #a9b3c3;  /* secondary text */
  --red:       #b3262d;  /* CTA only */
  --red-hover: #c8323a;
  /* Backwards compatibility for existing dashboards */
  --bg: var(--navy-950);
  --card: var(--navy-900);
  --text: var(--ink);
  --text2: var(--ink-dim);
  --border: var(--line);


  --line:      rgba(201, 162, 75, 0.28);   /* 1px gold hairline */
  --line-soft: rgba(243, 239, 228, 0.08);

  /* Type */
  --font-serif: "Noto Serif SC", "Songti SC", "SimSun", serif;
  --font-sans:  "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;

  /* Shape & space */
  --radius: 10px;                 /* one radius for everything */
  --radius-pill: 999px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --page: 1040px;
  --gap: clamp(28px, 5vw, 56px);  /* space between sections */
}

/* ---------- Base ---------- */
:root {
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

html, body {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
}

/* ---------- Global Sleek Apple / Glass Scrollbar ---------- */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background-clip: padding-box;
  transition: background 0.2s ease;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(241, 196, 15, 0.5);
}
::-webkit-scrollbar-corner {
  background: transparent;
}

/* Form Controls & Containers */
textarea, select, pre, .form-control, .form-input, .form-control-glass, .tbl-wrap {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) rgba(255, 255, 255, 0.02);
}
textarea::-webkit-scrollbar,
select::-webkit-scrollbar,
pre::-webkit-scrollbar,
.form-control::-webkit-scrollbar,
.form-input::-webkit-scrollbar,
.form-control-glass::-webkit-scrollbar,
.tbl-wrap::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
textarea::-webkit-scrollbar-track,
select::-webkit-scrollbar-track,
pre::-webkit-scrollbar-track,
.form-control::-webkit-scrollbar-track,
.form-input::-webkit-scrollbar-track,
.form-control-glass::-webkit-scrollbar-track,
.tbl-wrap::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  margin: 4px;
}
textarea::-webkit-scrollbar-thumb,
select::-webkit-scrollbar-thumb,
pre::-webkit-scrollbar-thumb,
.form-control::-webkit-scrollbar-thumb,
.form-input::-webkit-scrollbar-thumb,
.form-control-glass::-webkit-scrollbar-thumb,
.tbl-wrap::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 8px;
}
textarea::-webkit-scrollbar-thumb:hover,
select::-webkit-scrollbar-thumb:hover,
pre::-webkit-scrollbar-thumb:hover,
.form-control::-webkit-scrollbar-thumb:hover,
.form-input::-webkit-scrollbar-thumb:hover,
.form-control-glass::-webkit-scrollbar-thumb:hover,
.tbl-wrap::-webkit-scrollbar-thumb:hover {
  background: rgba(241, 196, 15, 0.6);
}

body {
  margin: 0;
  background: var(--navy-950);
  color: var(--ink);
  font-family: var(--font-sans);
  font-weight: 400;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* faint xiangqi board lines behind the whole page */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 70%);
  opacity: 0.6;
}

h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 700;
  line-height: 1.3;
  margin: 0;
}

a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--gold-soft);
  outline-offset: 3px;
  border-radius: 4px;
}

.container { max-width: var(--page); margin-inline: auto; padding-inline: 20px; }
.section   { margin-top: var(--gap); }

/* ---------- Navigation ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px clamp(16px, 4vw, 40px);
  background: rgba(7, 16, 30, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.nav__brand { display: flex; align-items: center; gap: 12px; }

/* The logo has a light background, so it sits in a light round badge */
.nav__logo,
.hero__logo {
  border-radius: 50%;
  background: #faf8f2;
  border: 1px solid var(--gold);
  object-fit: cover;
}
.nav__logo  { width: 40px; height: 40px; }

.nav__title { font-family: var(--font-serif); font-size: 1.05rem; line-height: 1.2; }
.nav__sub   { display: block; font-family: var(--font-sans); font-size: 0.68rem;
              letter-spacing: 0.22em; color: var(--gold); }

.nav__links { display: flex; align-items: center; gap: clamp(14px, 2.4vw, 30px); }

/* every link the same colour — no more green / yellow mix */
.nav__links a {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.9rem; color: var(--ink-dim);
  padding: 6px 0;
  border-bottom: 1px solid transparent;
  transition: color .2s, border-color .2s;
}
.nav__links a:hover,
.nav__links a[aria-current="page"] { color: var(--ink); border-color: var(--gold); }

.nav__links svg { width: 16px; height: 16px; stroke: var(--gold); fill: none; stroke-width: 1.6; }

.lang { display: flex; gap: 2px; padding-left: 16px; border-left: 1px solid var(--line); }
.lang button {
  background: none; border: 0; cursor: pointer;
  color: var(--ink-dim); font: inherit; font-size: 0.8rem; padding: 4px 8px;
  border-radius: 6px;
}
.lang button[aria-pressed="true"] { color: var(--navy-950); background: var(--gold); }

/* ---------- Hero ---------- */
.hero {
  margin-top: 40px;
  padding: clamp(32px, 6vw, 64px) 24px;
  text-align: center;
  background: linear-gradient(180deg, var(--navy-800), var(--navy-900));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.hero__logo { width: clamp(84px, 12vw, 120px); height: auto; aspect-ratio: 1; margin-bottom: 20px; }

.hero__title {
  font-size: clamp(1.9rem, 4.6vw, 3rem);
  letter-spacing: 0.12em;
  color: var(--ink);
}
.hero__en {
  margin-top: 8px;
  font-size: 0.8rem; letter-spacing: 0.4em; color: var(--gold);
}
.hero__tagline {
  margin: 18px auto 0; max-width: 34em;
  font-family: var(--font-serif); font-weight: 500;
  color: var(--ink-dim);
}

.hero__badges {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 10px;
  margin-top: 28px;
}
.badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 16px;
  font-size: 0.82rem; color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: rgba(201, 162, 75, 0.06);
}
.badge svg { width: 15px; height: 15px; stroke: var(--gold); fill: none; stroke-width: 1.6; }

/* ---------- Announcement (replaces the peach banner) ---------- */
.announce {
  display: grid; grid-template-columns: 150px 1fr; gap: 28px; align-items: center;
  padding: 24px;
  background: var(--navy-900);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.announce__poster {
  width: 100%; border-radius: 6px;
  border: 1px solid var(--line);
}
.tag {
  display: inline-block; padding: 3px 12px;
  font-size: 0.75rem; letter-spacing: 0.08em;
  color: var(--gold-soft);
  border: 1px solid var(--gold); border-radius: var(--radius-pill);
}
.announce__title { margin: 12px 0 14px; font-size: clamp(1.25rem, 2.6vw, 1.7rem); }

.meta { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 6px; }
.meta li { display: flex; gap: 10px; align-items: center; color: var(--ink-dim); font-size: 0.92rem; }
.meta svg { width: 16px; height: 16px; flex: none; stroke: var(--gold); fill: none; stroke-width: 1.6; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 24px;
  font: 500 0.95rem var(--font-sans);
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .2s, border-color .2s, transform .15s;
}
.btn--primary { background: var(--red); color: #fff; border-color: rgba(255,255,255,.12); }
.btn--primary:hover { background: var(--red-hover); }
.btn--ghost   { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--gold); }
.btn:active { transform: translateY(1px); }

/* ---------- Match ticker (faded edges) ---------- */
.ticker {
  overflow: hidden;
  padding: 10px 0;
  border-block: 1px solid var(--line);
  font-size: 0.85rem; color: var(--ink-dim);
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
.ticker__track { display: flex; gap: 40px; width: max-content; animation: ticker 40s linear infinite; }
.ticker__item b { color: var(--ink); font-weight: 500; }
.ticker__score  { color: var(--gold-soft); margin-inline: 8px; }
@keyframes ticker { to { transform: translateX(-50%); } }

/* ---------- Section headings ---------- */
.section__head { text-align: center; margin-bottom: 28px; }
.section__title { font-size: clamp(1.4rem, 3vw, 1.9rem); letter-spacing: 0.06em; }
.section__title::after {
  content: ""; display: block; width: 56px; height: 1px; margin: 14px auto 0;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.section__sub { margin-top: 10px; color: var(--ink-dim); font-size: 0.9rem; }

/* ---------- Empty state (album) ---------- */
.empty {
  padding: 36px 20px; text-align: center;
  color: var(--ink-dim);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

/* ---------- Leaderboard podium ---------- */
.podium {
  display: grid; grid-template-columns: 1fr 1.15fr 1fr;
  gap: 16px; align-items: end;
}
.rank-card {
  padding: 24px 16px; text-align: center;
  background: var(--navy-900);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.rank-card--1 { padding-block: 36px; border-color: var(--gold);
                background: linear-gradient(180deg, var(--navy-800), var(--navy-900)); }

/* numbered badge instead of emoji medals */
.rank-card__no {
  width: 38px; height: 38px; margin: 0 auto 12px;
  display: grid; place-items: center;
  font: 700 1rem var(--font-serif);
  color: var(--gold-soft);
  border: 1px solid var(--gold); border-radius: 50%;
}
.rank-card--1 .rank-card__no { background: var(--gold); color: var(--navy-950); }
.rank-card--2 .rank-card__no { border-color: var(--silver); color: var(--silver); }

.rank-card__name   { font-family: var(--font-serif); font-size: 1.2rem; }
.rank-card__school { margin-top: 2px; font-size: 0.82rem; color: var(--ink-dim); }
.rank-card__title  { display: inline-block; margin-top: 12px; padding: 2px 12px;
                     font-size: 0.78rem; color: var(--gold-soft);
                     border: 1px solid var(--line); border-radius: var(--radius-pill); }
.rank-card__rating { display: block; margin-top: 10px;
                     font: 700 1.6rem var(--font-serif); color: var(--ink); }

/* ---------- Ranking table ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin: 36px 0 14px; }
.input, .select {
  background: var(--navy-900); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 9px 14px; font: inherit; font-size: 0.9rem;
}
.input { flex: 1 1 220px; }
.input::placeholder { color: var(--ink-dim); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th, .table td { padding: 12px 16px; text-align: left; white-space: nowrap; }
.table thead th {
  font-weight: 500; font-size: 0.8rem; letter-spacing: 0.08em; color: var(--gold);
  background: var(--navy-900); border-bottom: 1px solid var(--line);
}
.table tbody tr + tr td { border-top: 1px solid var(--line-soft); }
.table tbody tr:hover td { background: rgba(201, 162, 75, 0.05); }
.table td.num { font-variant-numeric: tabular-nums; text-align: right; }

/* ---------- Footer ---------- */
.footer {
  margin-top: calc(var(--gap) * 1.5);
  padding: 40px 20px 28px;
  background: var(--navy-900);
  border-top: 1px solid var(--gold);
  color: var(--ink-dim); font-size: 0.88rem;
}
.footer__grid {
  max-width: var(--page); margin-inline: auto;
  display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px;
}
.footer h3 { font-size: 1rem; color: var(--ink); margin-bottom: 12px; }
.footer a:hover { color: var(--gold-soft); }
.footer__legal {
  max-width: var(--page); margin: 28px auto 0; padding-top: 16px;
  border-top: 1px solid var(--line-soft); font-size: 0.8rem; text-align: center;
}

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .nav__links a span { display: none; }         /* icons only on small screens */
  .announce { grid-template-columns: 1fr; text-align: center; }
  .announce__poster { max-width: 160px; margin-inline: auto; }
  .meta li { justify-content: center; }
  .podium { grid-template-columns: 1fr; }
  .rank-card--1 { order: -1; }
  .footer__grid { grid-template-columns: 1fr; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ticker__track { animation: none; }
  .btn { transition: none; }
}

/* Fix footer width */
.footer { width: 100%; margin-top: auto; }


/* ========================================================
   UNIFIED PUBLIC NAVIGATION & APPLE MEGA MENU SYSTEM
   ======================================================== */
.public-nav-bar {
  width: 100% !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding: 12px 20px !important;
  background: var(--top-color) !important;
  backdrop-filter: blur(var(--top-blur)) !important;
  -webkit-backdrop-filter: blur(var(--top-blur)) !important;
  border-bottom: 1px solid var(--top-border) !important;
  position: sticky !important;
  top: 0 !important;
  left: 0 !important;
  z-index: 9600 !important;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.4) !important;
}

.apple-mega-menu {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  z-index: 9500 !important;
  background: var(--mega-bg) !important;
  backdrop-filter: blur(var(--mega-blur)) !important;
  -webkit-backdrop-filter: blur(var(--mega-blur)) !important;
  border-bottom: 1px solid var(--top-border) !important;
  transform: translateY(-100%);
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
  padding: 85px 30px 45px !important;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5) !important;
}
.apple-mega-menu.open {
  transform: translateY(0) !important;
}

.apple-backdrop, .apple-mega-backdrop {
  position: fixed !important;
  inset: 0 !important;
  z-index: 9400 !important;
  background: rgba(0, 0, 0, 0.45) !important;
  backdrop-filter: blur(var(--backdrop-blur)) !important;
  -webkit-backdrop-filter: blur(var(--backdrop-blur)) !important;
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity 0.4s ease !important;
}
.apple-backdrop.open, .apple-mega-backdrop.open {
  opacity: 1 !important;
  pointer-events: auto !important;
}
