:root {
  color-scheme: dark;
  --bg: #060607;
  --panel: #121214;
  --panel-2: #17181b;
  --text: #f5f5f7;
  --muted: #9a9aa4;
  --accent: #4d8dff;
  --accent-dim: #2c4a8a;
  --border: #232327;
  --gold: #ffd75e;
  --silver: #a9b7d1;
  --bronze: #e3a469;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
}

/* ---------- Page content ---------- */
.page-content {
  padding: 3.5rem 1.25rem 4rem;
}

.site-header {
  max-width: 720px;
  margin: 0 auto 2rem;
  text-align: center;
}

h1 {
  margin: 0 0 1rem;
  font-size: clamp(2.75rem, 11vw, 5.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--text);
}

.subtitle {
  color: var(--muted);
  margin: 0 auto;
  max-width: 420px;
}

main {
  max-width: 720px;
  margin: 0 auto;
}

#search-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

#clan-tag-input {
  flex: 1;
  padding: 0.65rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 1rem;
}

button {
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: white;
  font-weight: 600;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.1);
}

#status {
  min-height: 1.25rem;
  color: var(--muted);
  margin: 0.25rem 0 1.25rem;
}

#status.error {
  color: #ff8080;
}

#clan-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

#clan-badge {
  width: 56px;
  height: 56px;
}

.clan-info-text {
  flex: 1;
}

.clan-name-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

#clan-name {
  margin: 0;
}

#old-history-select,
#raid-history-select {
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 0.8rem;
}

.pill-button {
  display: inline-block;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.pill-button:hover {
  filter: brightness(1.3);
}

.month-title {
  text-align: center;
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

#clan-meta {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border-radius: 10px;
  overflow: hidden;
}

th, td {
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}

th {
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: rgba(77, 141, 255, 0.08);
}

/* ---------- Podium highlighting for the top 3 leaderboard rows ---------- */
/* Subtle tint + slightly taller row, not a dramatic size jump. */
tbody tr.rank-gold,
tbody tr.rank-silver,
tbody tr.rank-bronze {
  font-size: 1.02em;
}

tbody tr.rank-gold td,
tbody tr.rank-silver td,
tbody tr.rank-bronze td {
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
}

tbody tr.rank-gold {
  background: linear-gradient(90deg, rgba(255, 215, 94, 0.14), transparent 70%);
}

tbody tr.rank-gold td:nth-child(2) {
  color: var(--gold);
  font-weight: 700;
}

tbody tr.rank-silver {
  background: linear-gradient(90deg, rgba(215, 217, 224, 0.12), transparent 70%);
}

tbody tr.rank-silver td:nth-child(2) {
  color: var(--silver);
  font-weight: 700;
}

tbody tr.rank-bronze {
  background: linear-gradient(90deg, rgba(227, 164, 105, 0.14), transparent 70%);
}

tbody tr.rank-bronze td:nth-child(2) {
  color: var(--bronze);
  font-weight: 700;
}

#war-section,
#history-section,
#old-history-section,
#raid-archive-section {
  margin-top: 2rem;
}

#war-section h2,
#history-section h2,
#old-history-section h2,
#raid-archive-section h2 {
  font-size: 1.15rem;
  margin: 0 0 0.4rem;
}

/* Pulsing red dot next to "Current War" while a war is actually active
   (preparation day or the war itself) — a quick "this is live right now"
   signal at a glance. */
.live-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff4d4d;
  margin-left: 0.5rem;
  vertical-align: middle;
  animation: live-dot-pulse 1.8s ease-out infinite;
}

/* Same specificity as .live-dot above, so source order alone would decide
   the winner — spelled out explicitly so a hidden dot actually stays
   hidden regardless of rule order. */
.live-dot[hidden] {
  display: none;
}

@keyframes live-dot-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 77, 77, 0.55);
  }
  70% {
    box-shadow: 0 0 0 9px rgba(255, 77, 77, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 77, 77, 0);
  }
}

#war-section table,
#history-section table,
#old-history-section table,
#raid-archive-section table {
  margin-top: 0.5rem;
}

.table-scroll {
  overflow-x: auto;
}

/* ---------- Hamburger menu ---------- */
.menu-toggle {
  position: fixed;
  top: 1.25rem;
  left: 1.25rem;
  z-index: 50;
  width: 42px;
  height: 42px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));
  transition: transform 0.25s ease, opacity 0.2s ease;
}

.menu-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.menu-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.side-drawer {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: min(360px, 88vw);
  background: var(--panel-2);
  border-right: 1px solid var(--border);
  z-index: 45;
  padding: 5rem 1.5rem 2rem;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
}

.side-drawer.open {
  transform: translateX(0);
}

.drawer-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.drawer-tab {
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

.drawer-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.drawer-panel h3 {
  font-size: 1rem;
  margin: 1.25rem 0 0.4rem;
}

.drawer-panel h3:first-child {
  margin-top: 0;
}

.drawer-panel p,
.drawer-panel li {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.drawer-panel strong {
  color: var(--text);
}

.drawer-panel ul {
  margin: 0.3rem 0 1rem;
  padding-left: 1.2rem;
}

.faq-item {
  margin-bottom: 0.5rem;
}

.faq-footer {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
}

.faq-footer a {
  color: var(--accent);
}

@media (max-width: 600px) {
  .page-content {
    /* Extra top clearance so the big title never sits behind the fixed
       hamburger button in the corner. */
    padding: 4.5rem 1rem 3rem;
  }

  #search-form {
    flex-wrap: wrap;
  }

  #clan-info {
    flex-wrap: wrap;
  }

  th, td {
    padding: 0.5rem 0.55rem;
    font-size: 0.85rem;
  }
}