@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@600;800;900&family=Rajdhani:wght@500;600;700&family=Inter:wght@400;500;600&display=swap');

:root {
  --void: #07070a;
  --void-2: #0d0d12;
  --panel: #131318;
  --panel-2: #1a1a21;
  --line: #26262f;
  --blood: #c81e26;
  --blood-dark: #4a0d10;
  --blood-light: #ff4b4b;
  --steel: #e3e6ea;
  --steel-dim: #8b909a;
  --gold: #e8a733;
  --gold-dim: #b3811f;
  --gold-bright: #ffcf5c;
  --ember: #ff6a1f;
  --text: #e9e9ec;
  --text-dim: #9a9aa4;
  --text-faint: #62626c;
  --font-display: 'Orbitron', sans-serif;
  --font-ui: 'Rajdhani', sans-serif;
  --font-body: 'Inter', sans-serif;
  --rail-w: 60px;
  --sidebar-w: 240px;
  --tab-h: 52px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--void);
  color: var(--text);
  font-family: var(--font-body);
  overflow-x: hidden;
  position: relative;
}
a { color: inherit; text-decoration: none; }
::selection { background: var(--blood); color: #fff; }
:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 2px;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  background: repeating-linear-gradient(to bottom,
      rgba(255, 255, 255, 0.015) 0px,
      rgba(255, 255, 255, 0.015) 1px,
      transparent 1px,
      transparent 3px);
  mix-blend-mode: overlay;
}

.site-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: var(--void);
}
.site-bg-layer {
  position: absolute;
  inset: -6%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  will-change: opacity, transform;
  filter: saturate(0.85) contrast(1.05) brightness(0.62);
}
.site-bg-1 {
  background-image: url('../Images/bg/bg1.png');
  animation: bgCrossfadeA 26s ease-in-out infinite, bgDrift1 42s ease-in-out infinite;
}
.site-bg-2 {
  background-image: url('../Images/bg/bg2.png');
  opacity: 0;
  animation: bgCrossfadeB 26s ease-in-out infinite, bgDrift2 48s ease-in-out infinite;
}
@keyframes bgCrossfadeA {
  0%, 40% { opacity: 1; }
  50%, 90% { opacity: 0; }
  100% { opacity: 1; }
}
@keyframes bgCrossfadeB {
  0%, 40% { opacity: 0; }
  50%, 90% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes bgDrift1 {
  0%, 100% { transform: scale(1.06) translate3d(0, 0, 0); }
  50% { transform: scale(1.14) translate3d(-1.4%, -1%, 0); }
}
@keyframes bgDrift2 {
  0%, 100% { transform: scale(1.1) translate3d(0, 0, 0); }
  50% { transform: scale(1.18) translate3d(1.4%, 1.2%, 0); }
}
.site-bg-grid {
  position: absolute;
  inset: -10%;
  background-image:
    linear-gradient(rgba(232,167,51,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232,167,51,0.05) 1px, transparent 1px);
  background-size: 46px 46px;
  mix-blend-mode: overlay;
  opacity: 0.5;
  animation: gridDrift 34s linear infinite;
}
@keyframes gridDrift {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-46px, -46px, 0); }
}
.site-bg-tint {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(7,7,10,0.35) 0%, rgba(7,7,10,0.72) 55%, rgba(7,7,10,0.94) 100%),
    radial-gradient(closest-side, transparent 0%, rgba(7,7,10,0.55) 100%);
}
@media (max-width: 640px) {
  .site-bg-layer { filter: saturate(0.85) contrast(1.05) brightness(0.5); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.reveal.in { opacity: 1; transform: translateY(0); }


.particles-canvas {
  position: fixed;
  inset: 0;
  z-index: 350;
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: 0.85;
}
@media (prefers-reduced-motion: reduce) {
  .particles-canvas { display: none; }
}
@media (max-width: 480px) {
  .particles-canvas { opacity: 0.6; }
}

.side-nav {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: var(--sidebar-w);
  background: rgba(7, 7, 10, 0.97);
  backdrop-filter: blur(8px);
  border-right: 1px solid var(--line);
  z-index: 300;
  display: flex;
  flex-direction: column;
  transition: width 0.22s ease;
  overflow: hidden;
}
.side-nav.collapsed { width: var(--rail-w); }

.side-nav-top {
  display: flex;
  align-items: center;
  padding: 14px 0 14px 20px;
  flex-shrink: 0;
}
.side-nav.collapsed .side-nav-top { justify-content: center; padding-left: 0; }

.side-nav-toggle {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  border-radius: 4px;
}
.side-nav-toggle:hover { background: rgba(255,255,255,0.06); }
.side-nav-toggle .toggle-bar {
  position: relative;
  display: block;
  width: 18px;
  height: 13px;
  border: 1.5px solid var(--text-dim);
  border-radius: 3px;
}
.side-nav-toggle:hover .toggle-bar { border-color: var(--gold-bright); }
.side-nav-toggle .toggle-bar-b::after {
  content: '';
  position: absolute;
  top: -1.5px;
  left: 5px;
  width: 1.5px;
  height: 13px;
  background: var(--text-dim);
}
.side-nav-toggle:hover .toggle-bar-b::after { background: var(--gold-bright); }

.side-nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 20px 18px 20px;
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 1px;
  color: var(--steel);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  flex-shrink: 0;
}
.side-nav-brand .brand-mark {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  background: var(--blood);
  transform: rotate(45deg);
  box-shadow: 0 0 8px var(--blood);
}
.side-nav-brand small {
  display: block;
  font-family: var(--font-ui);
  font-size: 10px;
  color: var(--gold);
  letter-spacing: 3px;
  font-weight: 600;
}
.side-nav.collapsed .nav-label { display: none; }

.side-nav-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 10px;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 1px;
  color: var(--text-dim);
}
.side-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0 11px 10px;
  border-left: 2px solid transparent;
  border-radius: 2px;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  white-space: nowrap;
  cursor: pointer;
}
.side-nav-link .nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.side-nav-link:hover { color: var(--gold); background: rgba(232,167,51,0.06); }
.side-nav.collapsed .side-nav-link { justify-content: center; padding-left: 0; }
.side-nav.collapsed .side-nav-link .nav-text { display: none; }

.side-nav-footer {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 0.5px;
  color: var(--text-faint);
  white-space: nowrap;
}

.site-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 250;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.site-overlay.show { opacity: 1; pointer-events: auto; }

.site-content {
  margin-left: var(--sidebar-w);
  transition: margin-left 0.22s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}
.site-content.collapsed { margin-left: var(--rail-w); }

.tab-bar-wrap {
  position: sticky;
  top: 0;
  z-index: 200;
  background: rgba(7, 7, 10, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 0 24px;
  height: var(--tab-h);
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.tab-bar-wrap .tab-spacer { flex: 1; }
.tab-btn {
  background: none;
  border: none;
  padding: 8px 18px;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  border-radius: 2px 2px 0 0;
}
.tab-btn:hover { color: var(--steel); background: rgba(255,255,255,0.03); }
.tab-btn.active {
  color: var(--gold-bright);
  border-bottom-color: var(--gold);
  background: rgba(232,167,51,0.06);
}
.tab-btn .tab-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  background: rgba(255,255,255,0.08);
  padding: 0 7px;
  border-radius: 10px;
  margin-left: 6px;
  color: var(--text-faint);
}
.tab-btn.active .tab-badge {
  background: rgba(232,167,51,0.2);
  color: var(--gold-bright);
}

.tab-btn.topup-btn {
  color: #fff;
  background: linear-gradient(180deg, var(--gold), var(--gold-dim));
  border: 1px solid var(--gold-dim);
  border-bottom: 1px solid var(--gold-dim);
  border-radius: 4px;
  margin-left: 8px;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 0 14px rgba(232,167,51,0.25);
  opacity: 0.45;
  pointer-events: none;
  transition: box-shadow 0.15s, transform 0.15s, opacity 0.15s;
}
.tab-btn.topup-btn.is-ready {
  opacity: 1;
  pointer-events: auto;
}
.tab-btn.topup-btn:hover {
  color: #fff;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  box-shadow: 0 0 18px rgba(232,167,51,0.45);
  transform: translateY(-1px);
}

.tab-panels {
  flex: 1;
  position: relative;
  overflow: hidden;
}
.tab-track {
  display: flex;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}
.tab-panel {
  flex: 0 0 100%;
  padding: 28px 32px 60px;
  box-sizing: border-box;
  display: block !important;
}
.tab-panel.active {
  display: block !important;
}

/* -------- HOME HERO (UPDATED) -------- */
.home-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 0 16px;
  position: relative;
}
.home-hero .hero-ring {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 1020px;
  margin-bottom: 18px;
}

.title-crossfade {
  position: relative;
  max-width: 1020px;
  width: 100%;
  aspect-ratio: 1200 / 381;
}

/* Base style for all images inside the crossfade */
.title-crossfade img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* ---- Corner Emblem (small badge that flips between two frames) ---- */
.corner-emblem {
  position: fixed;
  right: 24px;
  bottom: 90px;
  width: 64px;
  height: 64px;
  z-index: 400;
  pointer-events: none;
  perspective: 400px;
  filter: drop-shadow(0 4px 14px rgba(0,0,0,0.55));
}
.corner-emblem-flip {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  animation: emblemFlip 8s ease-in-out infinite;
}
.corner-emblem-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  backface-visibility: hidden;
}
.corner-emblem-img-b {
  transform: rotateY(180deg);
}
/* Flips face-to-face (like a coin), holds each face, then flips back */
@keyframes emblemFlip {
  0%, 42%  { transform: rotateY(0deg); }
  50%, 92% { transform: rotateY(180deg); }
  100%     { transform: rotateY(360deg); }
}
@media (max-width: 640px) {
  .corner-emblem { width: 48px; height: 48px; right: 16px; bottom: 78px; }
}


.title-frame-a {
  opacity: 1;
  animation: titleBreathe 9s ease-in-out infinite;
}
@keyframes titleBreathe {
  0%, 40%, 100% { transform: scale(1); }
  50% { transform: scale(1.015); }
}
.title-frame-b {
  opacity: 0;
  mix-blend-mode: screen;
  animation: titleFlicker 9s ease-in-out infinite;
}
@keyframes titleFlicker {
  0%, 38% { opacity: 0; transform: scale(1); }
  50% { opacity: 0.9; transform: scale(1.02); }
  62%, 100% { opacity: 0; transform: scale(1); }
}


@media (prefers-reduced-motion: reduce) {
  .corner-emblem-flip { animation: none !important; transform: rotateY(0deg) !important; }
  .title-frame-a, .title-frame-b { animation: none !important; }
  .title-frame-a { opacity: 1; }
  .title-frame-b { opacity: 0; }
}

/* ---------------------------------------- */

.home-hero .eyebrow {
  font-family: var(--font-ui);
  font-weight: 700;
  letter-spacing: 3px;
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.home-hero .eyebrow::before, .home-hero .eyebrow::after {
  content: '';
  width: 26px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line));
}
.home-hero .eyebrow::after { background: linear-gradient(90deg, var(--line), transparent); }
.home-hero .tagline {
  font-family: var(--font-ui);
  font-weight: 600;
  letter-spacing: 4px;
  font-size: 13px;
  color: var(--gold-bright);
  text-transform: uppercase;
  margin-top: 6px;
}
.home-hero .tagline .divider {
  color: var(--text-faint);
  margin: 0 10px;
}
.home-hero .sub {
  max-width: 520px;
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1.7;
  margin-top: 10px;
}
.hero-cta {
  display: flex;
  gap: 12px;
  margin-top: 26px;
  flex-wrap: wrap;
  justify-content: center;
}
.hero-cta .cta-btn {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 12px 26px;
  border: 1px solid var(--blood);
  background: var(--blood);
  color: #fff;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.15s;
}
.hero-cta .cta-btn:hover { box-shadow: 0 0 20px rgba(200,30,38,0.5); transform: translateY(-1px); }
.hero-cta .cta-btn.ghost {
  background: none;
  border-color: var(--line);
  color: var(--steel);
}
.hero-cta .cta-btn.ghost:hover { border-color: var(--gold); color: var(--gold-bright); box-shadow: 0 0 20px rgba(232,167,51,0.18); }

.home-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 36px;
  max-width: 640px;
  width: 100%;
}
.home-stat {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-top: 2px solid var(--line);
  padding: 16px 12px;
  text-align: center;
  transition: border-color 0.2s, transform 0.2s;
}
.home-stat:hover { border-top-color: var(--gold); transform: translateY(-2px); }
.home-stat .num {
  font-family: var(--font-display);
  font-size: 28px;
  color: var(--gold-bright);
  text-shadow: 0 0 18px rgba(232,167,51,0.25);
}
.home-stat .lbl {
  font-family: var(--font-ui);
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--text-faint);
  text-transform: uppercase;
  margin-top: 4px;
}

.factions {
  max-width: 900px;
  margin: 56px auto 0;
  width: 100%;
  text-align: center;
}
.factions-head {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 2px;
  color: var(--steel);
  margin-bottom: 4px;
}
.factions-sub {
  font-family: var(--font-ui);
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--text-faint);
  margin-bottom: 26px;
}
.faction-row {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 40px;
  flex-wrap: wrap;
}
.faction-crest {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 150px;
}
.faction-crest .crest-art {
  position: relative;
  width: 108px;
  height: 108px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.faction-crest .crest-art::before {
  content: '';
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow-color, rgba(232,167,51,0.22)) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.25s;
}
.faction-crest:hover .crest-art::before { opacity: 1; }
.faction-crest img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.5));
  transition: transform 0.25s;
}
.faction-crest:hover img { transform: translateY(-4px) scale(1.04); }
.faction-crest .crest-name {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 1.5px;
  color: var(--steel);
  text-transform: uppercase;
}
.faction-crest .crest-rank {
  font-family: var(--font-ui);
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--gold-bright);
  text-transform: uppercase;
}

.board-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.board-title {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 2px;
  color: var(--steel);
  display: flex;
  align-items: center;
  gap: 10px;
}
.board-title::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--ember);
  box-shadow: 0 0 8px var(--ember);
  transform: rotate(45deg);
}
.board-sub {
  font-family: var(--font-ui);
  font-size: 12px;
  letter-spacing: 1.5px;
  color: var(--text-faint);
}

.board-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
  overflow-x: auto;
  scrollbar-width: none;
}
.board-tabs::-webkit-scrollbar { display: none; }
.board-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.board-tab:hover { color: var(--steel); }
.board-tab .tab-count {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 10px;
  color: var(--text-faint);
  background: rgba(255,255,255,0.06);
  padding: 1px 7px;
  border-radius: 10px;
}
.board-tab.active[data-type="patch"] { color: var(--gold-bright); border-color: var(--gold); }
.board-tab.active[data-type="maintenance"] { color: var(--blood-light); border-color: var(--blood); }

.board-tab-panel {
  max-height: 480px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-right: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.board-tab-panel::-webkit-scrollbar { width: 8px; }
.board-tab-panel::-webkit-scrollbar-track { background: transparent; }
.board-tab-panel::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.board-tab-panel::-webkit-scrollbar-thumb:hover { background: var(--gold-dim); }

.notice {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-left: 3px solid var(--steel-dim);
  padding: 16px 18px;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.notice:hover {
  transform: translateX(2px);
  box-shadow: -3px 0 18px rgba(0,0,0,0.35);
}
.notice[data-type="patch"] { border-left-color: var(--gold); }
.notice[data-type="maintenance"] { border-left-color: var(--blood); }
.notice[data-type="event"] { border-left-color: #4ecfa0; }
.notice[data-type="information"] { border-left-color: var(--steel-dim); }
.notice-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.notice-tags {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tag {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  padding: 2px 8px;
  text-transform: uppercase;
  border: 1px solid currentColor;
}
.tag.patch { color: var(--gold-bright); }
.tag.maintenance { color: var(--blood-light); }
.tag.event { color: #4ecfa0; }
.tag.information { color: var(--steel-dim); }
.pin-icon { color: var(--gold); font-size: 13px; font-style: normal; }
.notice-date {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.notice-title {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 17px;
  color: var(--steel);
  margin: 0 0 4px;
  letter-spacing: 0.5px;
}
.notice-message {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-dim);
  white-space: pre-line;
}
.notice-author {
  margin-top: 10px;
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.5px;
}
.board-empty, .board-error {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-faint);
  font-family: var(--font-ui);
  letter-spacing: 1px;
}
.board-loading {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.skeleton {
  height: 80px;
  background: linear-gradient(90deg, var(--panel) 25%, var(--panel-2) 37%, var(--panel) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-left: 3px solid var(--line);
}
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  max-width: 960px;
  margin: 0 auto;
}
.source-grid-wide {
  grid-template-columns: repeat(2, 1fr);
  max-width: 760px;
}
.source-card {
  position: relative;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-top: 2px solid var(--line);
  padding: 24px 22px 22px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  transition: border-top-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.source-card:hover {
  transform: translateY(-3px);
  border-top-color: var(--gold);
  box-shadow: 0 14px 30px -14px rgba(0,0,0,0.6);
}
.source-icon {
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  color: var(--steel-dim);
  margin-bottom: 14px;
  transition: color 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.source-icon svg { width: 22px; height: 22px; }
.source-card:hover .source-icon {
  color: var(--gold-bright);
  border-color: var(--gold-dim);
  box-shadow: 0 0 16px rgba(232,167,51,0.18);
}
.source-icon.accent-gold { color: var(--gold-dim); }
.source-title {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.5px;
  color: var(--steel);
}
.source-desc {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-dim);
  margin-bottom: 16px;
  flex: 1;
}
.source-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 16px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.02);
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-faint);
  pointer-events: none;
  transition: all 0.15s;
}
.source-btn .btn-status {
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.5px;
  text-transform: none;
  color: var(--text-faint);
}
.source-btn.is-ready {
  border-color: var(--blood);
  background: var(--blood);
  color: #fff;
  pointer-events: auto;
}
.source-btn.is-ready .btn-status { color: rgba(255,255,255,0.75); }
.source-btn.is-ready:hover {
  box-shadow: 0 0 18px rgba(200,30,38,0.45);
  transform: translateY(-1px);
}
.panel-note {
  text-align: center;
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 0.5px;
  color: var(--text-faint);
  margin-top: 22px;
}

.info-grid {
  display: grid;
  gap: 20px;
  max-width: 800px;
  margin: 0 auto;
}
.info-card {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 20px;
  border-left: 3px solid var(--steel-dim);
}
.info-card h3 {
  font-family: var(--font-ui);
  color: var(--steel);
  margin: 0 0 6px;
}
.info-card p {
  color: var(--text-dim);
  margin: 0;
}
.info-meta {
  display: inline-block;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-faint);
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 16px 32px;
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 1px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  padding: 12px 18px;
  font-size: 13px;
  color: var(--steel);
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.2s;
  pointer-events: none;
  z-index: 500;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { border-left-color: var(--blood); }

@media (max-width: 860px) {
  .site-content, .site-content.collapsed { margin-left: var(--rail-w); }
  .side-nav:not(.collapsed) { box-shadow: 0 0 30px rgba(0,0,0,0.5); }
  .tab-bar-wrap { padding: 0 12px; }
  .tab-btn { font-size: 11px; padding: 6px 12px; letter-spacing: 1px; }
  .tab-panel { padding: 16px 16px 40px; }
  .home-stats { grid-template-columns: repeat(2, 1fr); }
  .board-tab-panel { max-height: 380px; }
  .faction-row { gap: 24px; }
  .faction-crest { width: 120px; }
  .faction-crest .crest-art { width: 88px; height: 88px; }
  .source-grid, .source-grid-wide { grid-template-columns: 1fr; max-width: 420px; }
  .info-grid { max-width: 100%; }
}
@media (max-width: 480px) {
  .tab-btn { font-size: 10px; padding: 4px 10px; }
  .tab-btn .tab-badge { display: none; }
  .tab-panel { padding: 12px 12px 30px; }
  .home-stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .home-stat .num { font-size: 20px; }
  .hero-cta { flex-direction: column; width: 100%; }
  .hero-cta .cta-btn { width: 100%; }
  .factions { margin-top: 40px; }
  .source-card { padding: 20px 18px; }
}

/* ===================================================================
   BGM PLAYER — base layout
   =================================================================== */
.bgm-player {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(10, 10, 18, 0.82);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding: 10px 16px 10px 14px;
    border-radius: 48px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 215, 0, 0.06);
    transition: box-shadow 0.3s ease, transform 0.25s ease, opacity 0.3s ease, border-color 0.3s ease;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}
.bgm-player:hover {
    transform: scale(1.02);
    border-color: rgba(255, 215, 0, 0.2);
}

/* Pulsing glow + border while music is actually playing — makes it feel "alive" */
.bgm-player.bgm-live {
    border-color: rgba(255, 215, 0, 0.22);
    animation: bgmPulse 2.6s ease-in-out infinite;
}
@keyframes bgmPulse {
    0%, 100% { box-shadow: 0 12px 40px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,215,0,0.08); }
    50%      { box-shadow: 0 12px 40px rgba(0,0,0,0.7), 0 0 28px rgba(255,215,0,0.22); }
}

.bgm-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}
.bgm-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    color: #ddd;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
    flex-shrink: 0;
    line-height: 1;
    padding: 0;
    position: relative;
}
.bgm-btn:hover {
    background: rgba(255, 215, 0, 0.18);
    color: #fff;
    transform: scale(1.08);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.08);
}
.bgm-btn:active {
    transform: scale(0.92);
}
.bgm-btn.is-active {
    background: rgba(255, 215, 0, 0.2);
    color: #f5d742;
    box-shadow: 0 0 24px rgba(255, 215, 0, 0.12);
}
.bgm-btn svg {
    width: 18px;
    height: 18px;
    display: block;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.bgm-btn.toggle-btn svg {
    transition: transform 0.2s;
}
.bgm-btn.toggle-btn:active svg {
    transform: scale(0.85);
}
.bgm-btn.toggle-btn.is-playing {
    background: rgba(255, 215, 0, 0.2);
    color: #f5d742;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.18);
}
.bgm-btn.toggle-btn.is-playing svg {
    stroke: #f5d742;
}
.bgm-btn.toggle-btn.is-error {
    opacity: 0.45;
    pointer-events: none;
}

/* Ring that spins gently around the toggle button while playing */
.bgm-btn.toggle-btn.is-playing::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 1.5px solid transparent;
    border-top-color: rgba(245, 215, 66, 0.55);
    border-right-color: rgba(245, 215, 66, 0.2);
    animation: bgmRingSpin 3s linear infinite;
    pointer-events: none;
}
@keyframes bgmRingSpin {
    to { transform: rotate(360deg); }
}

.bgm-divider {
    width: 1px;
    height: 28px;
    background: rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

/* ---- Mini equalizer bars — animate only while playing ---- */
.bgm-eq {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 16px;
    width: 16px;
    flex-shrink: 0;
}
.bgm-eq span {
    display: block;
    width: 3px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 2px;
    height: 30%;
    transition: background 0.3s;
}
.bgm-player.bgm-live .bgm-eq span {
    background: #f5d742;
    animation: bgmEqBounce 0.9s ease-in-out infinite;
}
.bgm-player.bgm-live .bgm-eq span:nth-child(1) { animation-delay: -0.6s; }
.bgm-player.bgm-live .bgm-eq span:nth-child(2) { animation-delay: -0.3s; }
.bgm-player.bgm-live .bgm-eq span:nth-child(3) { animation-delay: 0s; }
.bgm-player.bgm-live .bgm-eq span:nth-child(4) { animation-delay: -0.45s; }
@keyframes bgmEqBounce {
    0%, 100% { height: 25%; }
    50% { height: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    .bgm-player.bgm-live .bgm-eq span { animation: none; height: 60%; }
    .bgm-btn.toggle-btn.is-playing::before { animation: none; }
    .bgm-player.bgm-live { animation: none; }
}

.bgm-volume-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.bgm-volume {
    --volume-pct: 35%;
    width: 56px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 4px;
    outline: none;
    cursor: pointer;
    background: linear-gradient(to right,
        #f5d742 0%,
        #f5d742 var(--volume-pct),
        rgba(255, 255, 255, 0.15) var(--volume-pct),
        rgba(255, 255, 255, 0.15) 100%);
    transition: box-shadow 0.2s;
}
.bgm-volume:hover {
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.15);
}
.bgm-volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #f5d742;
    cursor: pointer;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.25);
    transition: transform 0.15s;
}
.bgm-volume::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}
.bgm-volume::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: none;
    background: #f5d742;
    cursor: pointer;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.25);
}
.bgm-volume::-moz-range-progress {
    background: #f5d742;
    height: 4px;
    border-radius: 4px;
}
.bgm-volume-label {
    font-size: 11px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
    min-width: 32px;
    text-align: center;
    letter-spacing: 0.3px;
    font-variant-numeric: tabular-nums;
}
.bgm-now-playing {
    font-size: 11px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.5);
    white-space: nowrap;
    letter-spacing: 0.3px;
    transition: opacity 0.3s;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bgm-now-playing strong {
    color: rgba(255, 215, 0, 0.7);
    font-weight: 500;
}
.bgm-status-badge {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.25);
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.04);
    transition: color 0.25s, border-color 0.25s, background 0.25s;
}
.bgm-status-badge.playing {
    color: #f5d742;
    border-color: rgba(255, 215, 0, 0.15);
    background: rgba(255, 215, 0, 0.06);
    animation: bgmBadgeGlow 2.6s ease-in-out infinite;
}
@keyframes bgmBadgeGlow {
    0%, 100% { text-shadow: 0 0 0 transparent; }
    50%      { text-shadow: 0 0 8px rgba(255, 215, 0, 0.5); }
}

@media (max-width: 640px) {
    .bgm-player {
        bottom: 16px;
        right: 16px;
        left: 16px;
        border-radius: 32px;
        padding: 8px 12px;
        gap: 8px;
        flex-wrap: wrap;
        justify-content: center;
    }
    .bgm-volume {
        width: 40px;
    }
    .bgm-now-playing {
        max-width: 80px;
        font-size: 10px;
    }
    .bgm-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    .bgm-btn svg {
        width: 16px;
        height: 16px;
    }
    .bgm-volume-label {
        font-size: 10px;
        min-width: 26px;
    }
}
@media (max-width: 480px) {
    .bgm-player {
        bottom: 12px;
        right: 12px;
        left: 12px;
        padding: 6px 10px;
        gap: 6px;
        border-radius: 28px;
    }
    .bgm-now-playing {
        display: none;
    }
    .bgm-volume {
        width: 32px;
    }
    .bgm-status-badge {
        display: none;
    }
}
