/* ============================================
   Elements of Chess — Main Stylesheet
   Every school. One board.
   Club colors injected via --club-primary / --club-secondary CSS vars
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&family=Bebas+Neue&family=Cinzel:wght@400;600;700;900&family=Crimson+Text:ital,wght@0,400;0,600;1,400&family=JetBrains+Mono:wght@400;600&display=swap');

/* ── CSS Variables ── */
:root {
  /* Club colors — overridden by JS at runtime from club data */
  --club-primary:   #1a1a2e;
  --club-secondary: #16213e;

  /* Derived from club colors */
  --color-primary:        var(--club-primary);
  --color-primary-bright: var(--club-primary);
  --color-primary-pale:   rgba(255,255,255,0.05);

  --gold:       #C9A84C;
  --gold-light: #E8C97A;
  --white:      #FAFAF8;
  --off-white:  #F2EDE8;
  --dark:       #0f0f1a;
  --dark-2:     #16213e;
  --dark-3:     #1a1a2e;
  --text-primary:   #1A1A2E;
  --text-secondary: #3a3a6e;
  --text-muted:     #8888aa;
  --border:         rgba(255,255,255,0.1);
  --shadow:         0 4px 24px rgba(0,0,0,0.3);
  --shadow-deep:    0 8px 48px rgba(0,0,0,0.5);
  --radius:    8px;
  --radius-lg: 16px;
  --font-display: 'Cinzel', serif;
  --font-body:    'Crimson Text', serif;
  --font-mono:    'JetBrains Mono', monospace;

  /* Surface colors */
  --surface:  #1a1a2e;
  --surface-2: #16213e;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: linear-gradient(160deg, var(--club-primary, #7A0000) 0%, color-mix(in srgb, var(--club-primary, #5A0000) 70%, #000) 45%, color-mix(in srgb, var(--club-primary, #3A0000) 40%, #000) 100%);
  background-attachment: fixed;
  color: var(--white);
  font-size: 17px;
  line-height: 1.6;
  min-height: 100vh;
}

/* Subtle grid background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    repeating-conic-gradient(rgba(255,255,255,0.015) 0% 25%, transparent 0% 50%);
  background-size: 80px 80px;
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle at 50% 30%, rgba(var(--club-primary-rgb, 26,26,46), 0.3) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ── Typography ── */
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.02em;
}
a { color: var(--club-primary); text-decoration: none; }
a:hover { opacity: 0.8; }

/* ── Header ── */
.site-header {
  background: #0d0d1a;
  border-bottom: 3px solid var(--club-primary);
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 20px rgba(0,0,0,0.6);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
}

.header-logo img {
  height: 44px;
  width: 44px;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(201,168,76,0.4));
}

.header-school-logo:not([src]),
.header-school-logo[src=""] { display: none; }

/* Atomic symbol logo for clubs without images */
.header-atomic {
  width: 44px;
  height: 44px;
  border: 2px solid var(--club-primary);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.05);
}

.header-atomic-number {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: rgba(255,255,255,0.4);
  line-height: 1;
}

.header-atomic-symbol {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--white);
  line-height: 1;
}

.header-logo-text {
  display: flex;
  flex-direction: column;
}

.header-logo-text .school-name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--white);
  letter-spacing: 0.08em;
  line-height: 1.1;
}

.header-logo-text .chess-label {
  font-family: var(--font-body);
  font-size: 0.72rem;
  color: var(--gold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-btn {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.7);
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  padding: 0.5rem 1rem;
  cursor: pointer;
  border-radius: var(--radius);
  transition: all 0.2s;
}
.nav-btn:hover { color: var(--white); background: rgba(255,255,255,0.08); }
.nav-btn.active { color: var(--gold); background: rgba(201,168,76,0.1); }

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-left: 1rem;
  border-left: 1px solid rgba(255,255,255,0.15);
  margin-left: 0.5rem;
}

.nav-user-info { text-align: right; }
.nav-username {
  font-family: var(--font-display);
  font-size: 0.82rem;
  color: var(--white);
  font-weight: 600;
}
.nav-elo { font-family: var(--font-mono); font-size: 0.72rem; }
.nav-elo.provisional { color: #ff9999; }
.nav-elo.official { color: #88dd88; }

.nav-logout {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.6);
  font-family: var(--font-display);
  font-size: 0.72rem;
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.04em;
}
.nav-logout:hover { background: rgba(255,255,255,0.12); color: var(--white); }

/* ── Pages ── */
.page {
  display: none;
  min-height: calc(100vh - 70px);
  position: relative;
  z-index: 1;
}
.page.active { display: block; }

/* ── Landing Page ── */
.landing-hero {
  min-height: calc(100vh - 70px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 2rem;
  position: relative;
  overflow: hidden;
}

.landing-chessboard-bg {
  position: absolute;
  inset: 0;
  background-image:
    repeating-conic-gradient(rgba(255,255,255,0.04) 0% 25%, transparent 0% 50%);
  background-size: 80px 80px;
}

.landing-content {
  position: relative;
  z-index: 1;
  max-width: 900px;
  width: 100%;

  /* Frosted glass panel */
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  padding: 3rem 3rem 2.5rem;
}

/* ── Landing hero layout ── */
.landing-hero-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.landing-school-logo {
  width: 200px;
  height: 200px;
  object-fit: contain;
  filter: drop-shadow(0 4px 24px rgba(0,0,0,0.5));
  flex-shrink: 0;
}

.landing-school-logo:not([src]),
.landing-school-logo[src=""] { display: none; }

.landing-eoc-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.landing-eoc-logo img {
  width: 105px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 16px rgba(0,0,0,0.5));
}

/* Periodic table element card for landing */
.landing-element-card {
  width: 105px;
  height: 150px;
  border: 4px solid rgba(255,255,255,0.9);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: transparent;
  box-shadow: 0 8px 40px rgba(0,0,0,0.3);
  padding: 0.5rem 0.5rem 0.75rem;
  position: relative;
  flex-shrink: 0;
}

.landing-element-number {
  font-family: 'Roboto', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: rgba(255,255,255,0.85);
  position: absolute;
  top: 8px;
  left: 11px;
  line-height: 1;
  letter-spacing: 0.04em;
}

.landing-element-symbol {
  font-family: 'Roboto', sans-serif;
  font-weight: 700;
  font-size: 3.5rem;
  color: #FFFFFF;
  line-height: 1;
  margin-top: 14px;
  letter-spacing: 0.02em;
  text-transform: none;
}

.landing-element-name {
  font-family: 'Roboto', sans-serif;
  font-weight: 500;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.9);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 0.3rem;
  text-align: center;
  line-height: 1.3;
}

.landing-eoc-card .landing-element-name {
  font-size: 0.55rem;
  letter-spacing: 0.08em;
}

.landing-eoc-symbol {
  font-size: 4rem;
}

.landing-title {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3.2vw, 2.8rem);
  font-weight: 900;
  color: var(--white);
  letter-spacing: 0.05em;
  line-height: 1.1;
  margin-bottom: 0.2rem;
  white-space: nowrap;
}

.landing-title-sub {
  font-family: var(--font-display);
  font-size: clamp(1rem, 2vw, 1.4rem);
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.4em;
  text-transform: uppercase;
  margin-bottom: 2rem;
}

.landing-subtitle {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--gold);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.landing-motto {
  font-family: var(--font-body);
  font-size: 1.25rem;
  color: rgba(255,255,255,0.4);
  margin-bottom: 3rem;
  letter-spacing: 0.05em;
}

.landing-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  max-width: 480px;
  margin: 0 auto;
}

.landing-actions .btn-primary.full-width { grid-column: 1 / -1; }

/* ── Buttons ── */
.btn-primary {
  background: linear-gradient(135deg, var(--club-primary) 0%, var(--club-secondary) 100%);
  color: var(--white);
  border: none;
  padding: 0.85rem 1.75rem;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.25s;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  text-transform: uppercase;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(0,0,0,0.4);
  filter: brightness(1.15);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: transparent;
  color: var(--white);
  border: 1.5px solid rgba(255,255,255,0.3);
  padding: 0.85rem 1.75rem;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.25s;
  text-transform: uppercase;
}
.btn-secondary:hover {
  border-color: rgba(255,255,255,0.7);
  background: rgba(255,255,255,0.08);
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  color: var(--white);
  border: 1.5px solid rgba(255,255,255,0.3);
  padding: 0.7rem 1.5rem;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
}
.btn-outline:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.6);
}

.btn-ghost {
  background: transparent;
  color: rgba(255,255,255,0.5);
  border: 1px solid rgba(255,255,255,0.15);
  padding: 0.6rem 1.2rem;
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-ghost:hover {
  color: var(--white);
  border-color: rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.06);
}

.btn-danger {
  background: linear-gradient(135deg, #8B0000 0%, #b00000 100%);
  color: var(--white);
  border: none;
  padding: 0.7rem 1.4rem;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-danger:hover { opacity: 0.9; transform: translateY(-1px); }

.btn-success {
  background: linear-gradient(135deg, #1a6b1a 0%, #2a8b2a 100%);
  color: var(--white);
  border: none;
  padding: 0.7rem 1.4rem;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-success:hover { opacity: 0.9; transform: translateY(-1px); }

/* ── Forms ── */
.form-container {
  max-width: 440px;
  margin: 0 auto;
  padding: 2.5rem;
  background: #1a1a2e;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 80px rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.1);
  position: relative;
  z-index: 1;
}

.form-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--white);
  margin-bottom: 1.75rem;
  text-align: center;
  position: relative;
  padding-bottom: 1rem;
}

.form-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--club-primary), transparent);
}

.form-group { margin-bottom: 1.25rem; }

.form-group label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--white);
  background: rgba(255,255,255,0.06);
  transition: all 0.2s;
  outline: none;
}
.form-group input:focus,
.form-group select:focus {
  border-color: var(--club-primary);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.05);
}
.form-group input::placeholder { color: rgba(255,255,255,0.25); }
.form-group select option { background: #1a1a2e; color: var(--white); }

.form-submit { width: 100%; margin-top: 0.5rem; }

.form-alt-link {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.9rem;
  color: rgba(255,255,255,0.4);
}
.form-alt-link a { color: var(--gold); font-weight: 600; }

.form-error {
  background: rgba(192,19,44,0.12);
  border: 1px solid rgba(192,19,44,0.3);
  color: #ff8888;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  display: none;
}
.form-error.visible { display: block; }

/* ── Auth pages ── */
.auth-page {
  min-height: calc(100vh - 70px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
  z-index: 1;
}


/* ── Dashboard ── */

/* ══════════════════════════════════════════════
   HERO HEADER
   ══════════════════════════════════════════════ */

.dash-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 2.5rem 0 2.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 2rem;
}

.dash-hero-placard {
  flex-shrink: 0;
  width: 105px;
  height: 150px;
  border: 4px solid rgba(255,255,255,0.9);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 8px 40px rgba(0,0,0,0.4);
}

.dash-hero-placard-num {
  font-family: 'Roboto', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: rgba(255,255,255,0.85);
  position: absolute;
  top: 8px; left: 11px;
  line-height: 1;
  letter-spacing: 0.04em;
}

.dash-hero-placard-sym {
  font-family: 'Roboto', sans-serif;
  font-weight: 700;
  font-size: 3.5rem;
  color: #fff;
  line-height: 1;
  margin-top: 14px;
  letter-spacing: 0.02em;
}

.dash-hero-placard-name {
  font-family: 'Roboto', sans-serif;
  font-weight: 500;
  font-size: 0.55rem;
  color: rgba(255,255,255,0.9);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  margin-top: 0.3rem;
  padding: 0 4px;
  line-height: 1.3;
}

.dash-hero-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 0;
  flex: 1;
  min-height: 150px;
}

.dash-hero-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.dash-hero-logo {
  max-height: 130px;
  max-width: 180px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 24px rgba(0,0,0,0.5));
}

.dash-hero-text {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Club placard in dashboard hero — reuses .landing-element-card styles */
.dash-hero-club-placard {
  flex-shrink: 0;
}

.dash-hero-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--white);
  letter-spacing: 0.04em;
  line-height: 1;
}

.dash-hero-tagline {
  font-family: var(--font-display);
  font-size: 0.82rem;
  color: var(--gold);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.dash-hero-divider {
  width: 50px;
  height: 2px;
  background: var(--club-primary);
  margin: 0.5rem auto 0;
  border-radius: 2px;
}

.dash-hero-welcome {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 900;
  color: var(--white);
  letter-spacing: 0.03em;
  margin-top: 1rem;
  text-align: center;
  line-height: 1.1;
}

/* ══════════════════════════════════════════════
   PERIODIC TABLE GRID
   ══════════════════════════════════════════════ */

.pt-section-label {
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.18);
  margin-bottom: 0.75rem;
}

.pt-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: auto auto auto auto;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.pt-card {
  position: relative;
  cursor: pointer;
}

.pt-atomic-label {
  position: absolute;
  top: 8px;
  left: 10px;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  color: rgba(255,255,255,0.45);
  line-height: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  pointer-events: none;
}

.pt-atomic-label span {
  font-size: 0.42rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.22);
  margin-top: 1px;
}

.pt-separator {
  grid-column: 1 / -1;
  height: 1px;
  background: rgba(255,255,255,0.05);
  align-self: center;
}

.pt-section-label-inline {
  grid-column: 1 / -1;
  font-family: var(--font-display);
  font-size: 0.58rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.16);
  padding-top: 2px;
}

.pt-action-card {
  min-height: 145px;
}

/* ══════════════════════════════════════════════
   DASHBOARD FOOTER
   ══════════════════════════════════════════════ */

.dash-footer {
  text-align: center;
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  color: rgba(255,255,255,0.16);
  padding: 1.5rem 0 0.5rem;
  border-top: 1px solid rgba(255,255,255,0.04);
  margin-top: 0.5rem;
}

/* ── Dashboard utility row (Report + Admin) ── */
.dash-utility-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding: 0 0.1rem;
}

.dash-utility-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  padding: 0.45rem 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.07em;
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.dash-utility-btn:hover {
  background: rgba(255,255,255,0.09);
  border-color: rgba(255,255,255,0.25);
  color: rgba(255,255,255,0.85);
}
.dash-utility-btn--admin {
  color: rgba(255,255,255,0.7);
  border-color: rgba(255,255,255,0.18);
}

/* ── Mobile admin gate page ── */
.admin-gate-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 56px);
  padding: 3rem 2rem;
  text-align: center;
}
.admin-gate-icon {
  font-size: 3rem;
  margin-bottom: 1.25rem;
  opacity: 0.4;
}
.admin-gate-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 1rem;
  color: var(--white);
}
.admin-gate-body {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: rgba(255,255,255,0.45);
  line-height: 1.7;
  max-width: 280px;
  margin-bottom: 2rem;
}
.admin-gate-cta {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,0.2);
  padding-bottom: 2px;
  margin-bottom: 1.5rem;
  transition: color 0.2s, border-color 0.2s;
}
.admin-gate-cta:hover { color: rgba(255,255,255,0.8); border-color: rgba(255,255,255,0.5); }
.admin-gate-back {
  background: none;
  border: none;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.3);
  cursor: pointer;
  padding: 0.5rem;
  transition: color 0.2s;
}
.admin-gate-back:hover { color: rgba(255,255,255,0.6); }

/* ══════════════════════════════════════════════
   CARD MODALS
   ══════════════════════════════════════════════ */

.dash-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.dash-modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.dash-modal {
  background: #1a1a2e;
  border: 1px solid rgba(255,255,255,0.08);
  border-top: 4px solid var(--club-primary);
  border-radius: var(--radius-lg);
  max-width: 460px;
  width: 100%;
  padding: 2rem;
  position: relative;
  transform: translateY(16px) scale(0.97);
  transition: transform 0.25s cubic-bezier(0.2,0.8,0.3,1);
  box-shadow: 0 40px 80px rgba(0,0,0,0.7);
}

.dash-modal-overlay.open .dash-modal {
  transform: translateY(0) scale(1);
}

.dash-modal-close {
  position: absolute;
  top: 1rem; right: 1rem;
  background: none;
  border: none;
  color: rgba(255,255,255,0.25);
  font-size: 1rem;
  cursor: pointer;
  transition: color 0.2s;
  line-height: 1;
  font-family: var(--font-display);
}
.dash-modal-close:hover { color: var(--white); }

.dash-modal-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.4rem;
}

.dash-modal-icon { font-size: 1.8rem; line-height: 1; }

.dash-modal-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--white);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dash-modal-section-label {
  font-family: var(--font-display);
  font-size: 0.58rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.28);
  margin-bottom: 0.55rem;
  margin-top: 1.1rem;
}

.dash-modal-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.dash-modal-stat {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  padding: 0.55rem 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.dash-modal-stat-label {
  font-family: var(--font-display);
  font-size: 0.65rem;
  color: rgba(255,255,255,0.35);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dash-modal-stat-value {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--white);
}

.dash-modal-training {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.dash-modal-training li {
  font-family: var(--font-display);
  font-size: 0.8rem;
  color: rgba(255,255,255,0.5);
  padding: 0.35rem 0.6rem;
  border-left: 2px solid var(--club-primary);
  letter-spacing: 0.04em;
}

.dash-modal-training li::before {
  content: '→ ';
  color: rgba(255,255,255,0.25);
}

.dash-modal-btn {
  width: 100%;
  margin-top: 1.4rem;
  background: linear-gradient(135deg, var(--club-primary) 0%, var(--club-secondary, var(--club-primary)) 100%);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  padding: 0.85rem;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
}

.dash-modal-btn:hover { opacity: 0.88; transform: translateY(-1px); }

/* ══════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════ */

@media (max-width: 900px) {
  .pt-grid { grid-template-columns: repeat(4, 1fr); }
  .dash-hero-title { font-size: 1.2rem; }
  .dash-hero-welcome { font-size: 1.4rem; }
  .dash-hero-placard { width: 84px; height: 104px; }
  .dash-hero-placard-sym { font-size: 2.4rem; }
  .dash-hero-logo { max-height: 90px; }
}

@media (max-width: 600px) {
  .dash-hero {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1.5rem 1rem 1.5rem;
  }
  .dash-hero-placard {
    order: 1;
    width: 80px;
    height: 100px;
    flex-shrink: 0;
  }
  .dash-hero-placard-sym { font-size: 2rem; }
  .dash-hero-club-placard {
    order: 2;
    width: 80px !important;
    height: 100px !important;
    max-width: 80px !important;
    max-height: 100px !important;
    flex-shrink: 0;
  }
  .dash-hero-club-placard .landing-element-symbol { font-size: 2rem; margin-top: 8px; }
  .dash-hero-club-placard .landing-element-number { font-size: 0.65rem; }
  .dash-hero-club-placard .landing-element-name   { font-size: 0.42rem; }
  /* Center block forced to its own full-width row below both placards */
  .dash-hero-center {
    order: 3;
    width: 100%;
    min-height: unset;
    text-align: center;
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 0.75rem;
  }
  .dash-hero-logo { max-height: 70px; }
  .dash-hero-welcome { font-size: 1.2rem; margin-top: 0; }
  .pt-grid { grid-template-columns: repeat(2, 1fr); grid-template-rows: unset; }
  .pt-grid > * { grid-column: unset !important; grid-row: unset !important; }
  .pt-separator, .pt-section-label-inline { display: none; }
  .dash-modal { padding: 1.5rem; }
}

.dashboard {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 2rem 6rem;
}

.dashboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 2.5rem;
  gap: 1rem;
}

.dashboard-greeting {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--white);
  font-weight: 700;
}

.dashboard-sub { font-size: 1rem; color: rgba(255,255,255,0.4); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: #1a1a2e;
  border: 1px solid rgba(255,255,255,0.06);
  border-top: 4px solid var(--club-primary);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  text-align: center;
  box-shadow: 0 20px 80px rgba(0,0,0,0.6);
  transition: transform 0.2s;
  color: var(--white);
}
.stat-card:hover { transform: translateY(-2px); }

.stat-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  color: var(--white);
  line-height: 1;
  margin-bottom: 0.25rem;
}

.stat-label {
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
}

.stat-card.elo .stat-value { color: var(--white); }
.stat-card.elo.provisional .stat-value { color: #ff9999; }
.stat-card.elo.official .stat-value { color: #88dd88; }

.dashboard-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}

.action-card {
  background: #1a1a2e;
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  color: var(--white);
  cursor: pointer;
  transition: all 0.25s;
  border: 1px solid rgba(255,255,255,0.06);
  border-top: 4px solid var(--club-primary);
  box-shadow: 0 20px 80px rgba(0,0,0,0.6);
}
.action-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255,255,255,0.15);
}
.action-card-icon { font-size: 2rem; margin-bottom: 0.75rem; }
.action-card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  color: var(--white);
}
.action-card-desc { font-size: 0.85rem; color: rgba(255,255,255,0.4); }

.action-card.primary-action {
  background: linear-gradient(135deg, var(--club-primary) 0%, var(--club-secondary) 100%);
  border-color: rgba(255,255,255,0.1);
  color: var(--white);
}
.action-card.primary-action .action-card-title { color: var(--white); }
.action-card.primary-action .action-card-desc { color: rgba(255,255,255,0.7); }

/* ── Time Control Selector ── */
.time-control-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.6rem;
  margin-bottom: 1rem;
}

/* ── Color Picker ── */
.color-picker {
  display: flex;
  gap: 0.5rem;
}

.color-btn {
  flex: 1;
  background: rgba(255,255,255,0.04);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 0.5rem 0.25rem;
  color: var(--white);
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.color-btn:hover { border-color: var(--club-primary); background: rgba(255,255,255,0.07); }
.color-btn.active {
  border-color: var(--club-primary);
  background: var(--club-primary);
  color: var(--white);
}

.tc-option {
  background: rgba(255,255,255,0.04);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 0.6rem 0.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.tc-option:hover { border-color: var(--club-primary); background: rgba(255,255,255,0.07); }
.tc-option.selected {
  border-color: var(--club-primary);
  background: var(--club-primary);
  color: var(--white);
}
.tc-option .tc-name {
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
}
.tc-option.selected .tc-name { color: rgba(255,255,255,0.7); }
.tc-option .tc-time {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--white);
}
.tc-option.selected .tc-time { color: var(--white); }

/* ── Modals ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.visible { display: flex; }

.modal {
  background: #1a1a2e;
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  max-width: 520px;
  width: 100%;
  box-shadow: 0 20px 80px rgba(0,0,0,0.6);
  border-top: 4px solid var(--club-primary);
  animation: slideUp 0.3s ease;
  color: var(--white);
}

@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--white);
  margin-bottom: 1.5rem;
  text-align: center;
}

.room-code-display {
  background: rgba(255,255,255,0.06);
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 2.5rem;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.25em;
  padding: 1.25rem;
  border-radius: var(--radius);
  margin: 1rem 0;
  cursor: pointer;
  transition: opacity 0.2s;
  user-select: all;
  border: 1px solid rgba(255,255,255,0.1);
}
.room-code-display:hover { opacity: 0.8; }

.room-code-copy-hint {
  text-align: center;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.35);
  margin-bottom: 1.5rem;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.waiting-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem;
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.05em;
}

.dot-pulse { display: flex; gap: 4px; }
.dot-pulse span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--club-primary);
  animation: pulse 1.4s ease-in-out infinite;
}
.dot-pulse span:nth-child(2) { animation-delay: 0.2s; }
.dot-pulse span:nth-child(3) { animation-delay: 0.4s; }
@keyframes pulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ── CHESS GAME PAGE ── */
.game-page {
  background: #0f0f1a;
  min-height: calc(100vh - 70px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.game-layout {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1.5rem;
  align-items: center;
  max-width: 1100px;
  width: 100%;
}

/* ── Player panels ── */
.player-panel {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  color: var(--white);
}
.player-panel.active-turn {
  border-color: var(--gold);
  background: rgba(201,168,76,0.05);
  box-shadow: 0 0 20px rgba(201,168,76,0.1);
}

.player-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 0.25rem;
}

.player-title-badge {
  display: inline-block;
  background: var(--gold);
  color: #0f0f1a;
  font-family: var(--font-display);
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  letter-spacing: 0.05em;
  margin-right: 0.4rem;
  vertical-align: middle;
}

.player-elo { font-family: var(--font-mono); font-size: 0.85rem; }
.player-elo.provisional { color: #ff9999; }
.player-elo.official { color: #88dd88; }

.player-color-badge {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 0.5rem;
}

/* ── Clock ── */
.clock {
  font-family: var(--font-mono);
  font-size: 2.5rem;
  font-weight: 600;
  color: var(--white);
  background: rgba(0,0,0,0.4);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  margin-top: 1rem;
  text-align: center;
  transition: color 0.3s;
  border: 1px solid rgba(255,255,255,0.08);
  letter-spacing: 0.05em;
}
.clock.active { color: var(--gold); border-color: var(--gold); }
.clock.low-time { color: #ff4444 !important; border-color: #ff4444 !important; animation: tick 1s ease-in-out infinite; }
.clock.untimed { color: rgba(255,255,255,0.2); font-size: 1rem; padding: 0.5rem; }
@keyframes tick {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ── Game controls ── */
.game-controls {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 1rem;
}
.game-controls .btn-danger,
.game-controls .btn-outline,
.game-controls .btn-success {
  width: 100%;
  font-size: 0.78rem;
  padding: 0.6rem 1rem;
}
.game-controls .btn-outline {
  color: rgba(255,255,255,0.6);
  border-color: rgba(255,255,255,0.2);
}
.game-controls .btn-outline:hover {
  color: var(--white);
  border-color: rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.06);
}

/* ── Messages ── */
.preset-msg-toggle {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.4);
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius);
  cursor: pointer;
  width: 100%;
  transition: all 0.2s;
}
.preset-msg-toggle:hover { color: var(--white); border-color: rgba(255,255,255,0.3); }

.preset-msg-list { display: none; flex-direction: column; gap: 0.4rem; margin-top: 0.5rem; }
.preset-msg-list.visible { display: flex; }

.preset-msg-btn {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.6);
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 0.4rem 0.75rem;
  border-radius: 5px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}
.preset-msg-btn:hover { background: rgba(255,255,255,0.08); color: var(--white); }

/* ── Message feed ── */
.message-feed {
  min-height: 60px;
  max-height: 120px;
  overflow-y: auto;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.msg-entry { font-size: 0.82rem; color: rgba(255,255,255,0.5); animation: fadeIn 0.2s ease; }
.msg-entry strong { color: var(--gold); font-style: normal; }
@keyframes fadeIn { from { opacity: 0; transform: translateX(-5px); } to { opacity: 1; } }

/* ── Chess Board ── */
#chess-board {
  width: min(500px, 90vw) !important;
  border: 3px solid var(--gold) !important;
  border-radius: 4px;
  box-shadow: 0 10px 60px rgba(0,0,0,0.6), 0 0 0 1px rgba(201,168,76,0.3);
  position: relative;
  z-index: 2;
}

#chess-board .board-b72b1 {
  border-radius: 4px;
  overflow: hidden;
}

#chess-board .square-55d63 { transition: none; }

/* Selected square — inset border only, no background */
.white-1e1d7.highlight-selected {
  background-color: #f0d9b5 !important;
  box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.4) !important;
}
.black-3c85d.highlight-selected {
  background-color: #b58863 !important;
  box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.4) !important;
}

/* Legal move squares — dot only, no background change */
.highlight-legal {
  position: relative;
}
.white-1e1d7.highlight-legal {
  background-color: #f0d9b5 !important;
}
.black-3c85d.highlight-legal {
  background-color: #b58863 !important;
}
.highlight-legal::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 28%; height: 28%;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

/* Pre-move — gold tint */
.highlight-premove { background-color: rgba(224, 186, 98, 0.55) !important; }

/* Last move — very subtle warm tint */
.white-1e1d7.highlight-lastmove { background-color: #c8d9a0 !important; }
.black-3c85d.highlight-lastmove { background-color: #8daa6b !important; }

/* Check — red */
.highlight-check { background-color: rgba(220, 30, 30, 0.6) !important; }

/* Drag ghost — chessboard.js appends a raw <img> to <body> during drag */
body > img.piece-417db {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  z-index: 9999 !important;
}

/* Prevent transition on board pieces interfering with drag */
#chess-board img.piece-417db {
  transition: none !important;
  transform: none !important;
}

/* ── PGN Viewer ── */
.pgn-viewer {
  width: min(500px, 90vw);
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.pgn-moves {
  padding: 0.75rem 1rem;
  min-height: 60px;
  max-height: 120px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.8;
  color: rgba(255,255,255,0.6);
  display: flex;
  flex-wrap: wrap;
  gap: 0.1rem 0.15rem;
  align-content: flex-start;
}
.pgn-moves::-webkit-scrollbar { width: 4px; }
.pgn-moves::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 2px; }

.pgn-placeholder { color: rgba(255,255,255,0.2); font-family: var(--font-body); font-size: 0.85rem; width: 100%; text-align: center; padding: 0.5rem 0; }
.pgn-move-number { color: rgba(255,255,255,0.25); user-select: none; padding: 0.1rem 0.2rem; }
.pgn-move { padding: 0.15rem 0.4rem; border-radius: 4px; cursor: pointer; transition: all 0.15s; color: rgba(255,255,255,0.7); white-space: nowrap; }
.pgn-move:hover { background: rgba(255,255,255,0.08); color: var(--white); }
.pgn-move.active { background: var(--club-primary); color: var(--white); font-weight: 600; }

.pgn-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.6rem 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.06);
  background: rgba(0,0,0,0.2);
}

.pgn-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7);
  font-size: 0.8rem;
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: -0.02em;
  width: 36px; height: 34px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.pgn-btn:hover { background: rgba(255,255,255,0.12); color: var(--white); border-color: rgba(255,255,255,0.25); }
.pgn-btn:disabled { opacity: 0.2; cursor: not-allowed; }
.pgn-copy { width: auto; padding: 0 0.75rem; font-size: 0.75rem; font-family: var(--font-display); letter-spacing: 0.04em; margin-left: 0.25rem; }
.pgn-counter { font-family: var(--font-mono); font-size: 0.75rem; color: rgba(255,255,255,0.3); min-width: 50px; text-align: center; }

/* ── Game over modal ── */
.game-over-modal { text-align: center; }
.game-over-result {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  margin-bottom: 0.5rem;
}
.game-over-result.win  { color: #2a8b2a; }
.game-over-result.loss { color: #cc2222; }
.game-over-result.draw { color: var(--gold); }

.game-over-reason { font-size: 1rem; color: rgba(255,255,255,0.4); margin-bottom: 1.5rem; }

.elo-change { font-family: var(--font-mono); font-size: 1.5rem; font-weight: 600; margin-bottom: 0.5rem; }
.elo-change.positive { color: #2a8b2a; }
.elo-change.negative { color: #cc2222; }
.elo-change.neutral  { color: var(--gold); }

.new-achievement {
  background: rgba(201,168,76,0.1);
  border: 1px solid var(--gold);
  color: var(--gold);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 0.85rem;
  margin: 0.25rem 0;
  animation: shimmer 2s ease-in-out infinite;
}
@keyframes shimmer {
  0%, 100% { border-color: var(--gold); }
  50% { border-color: var(--gold-light); box-shadow: 0 0 15px rgba(201,168,76,0.3); }
}

/* ── Leaderboard ── */
.leaderboard-page { max-width: 1000px; margin: 0 auto; padding: 2.5rem 2rem; }

.leaderboard-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 2rem; }
.leaderboard-title { font-family: var(--font-display); font-size: 2rem; font-weight: 900; color: var(--white); }
.leaderboard-subtitle { font-size: 18px; color: rgba(255,255,255,0.35); }

.leaderboard-table-wrap {
  background: #1a1a2e;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 80px rgba(0,0,0,0.6);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  border-top: 4px solid var(--club-primary);
}

.leaderboard-table { width: 100%; border-collapse: collapse; }
.leaderboard-table th {
  background: rgba(0,0,0,0.3);
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 1rem 1.25rem;
  text-align: left;
}
.leaderboard-table th:first-child { text-align: center; width: 60px; }
.leaderboard-table th:last-child { text-align: right; }
.leaderboard-table td {
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
  color: var(--white);
}
.leaderboard-table tr:last-child td { border-bottom: none; }
.leaderboard-table tr:hover td { background: rgba(255,255,255,0.03); }

.lb-rank { text-align: center; font-family: var(--font-mono); font-weight: 600; color: rgba(255,255,255,0.3); }
.lb-rank.top-1 { color: #C9A84C; font-size: 1.2rem; }
.lb-rank.top-2 { color: #A0A0A0; font-size: 1.1rem; }
.lb-rank.top-3 { color: #CD7F32; font-size: 1rem; }

.lb-username { font-family: var(--font-display); font-weight: 600; color: var(--white); font-size: 1rem; }
.lb-elo { font-family: var(--font-mono); font-weight: 600; font-size: 1.1rem; color: var(--white); }
.lb-elo.provisional { color: #ff9999; }
.lb-elo.official    { color: #88dd88; }
.lb-record { font-family: var(--font-mono); font-size: 0.82rem; color: rgba(255,255,255,0.4); text-align: right; }
.lb-streak { font-family: var(--font-mono); font-size: 0.85rem; }

/* ── Profile ── */
.profile-page { max-width: 900px; margin: 0 auto; padding: 2.5rem 2rem; }

.profile-header-card {
  background: #1a1a2e;
  border-radius: var(--radius-lg);
  padding: 2rem;
  color: var(--white);
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  border: 1px solid rgba(255,255,255,0.06);
  border-top: 4px solid var(--club-primary);
  box-shadow: 0 20px 80px rgba(0,0,0,0.6);
}

.profile-avatar {
  width: 80px; height: 80px;
  background: var(--club-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  color: var(--white);
  flex-shrink: 0;
  border: 3px solid var(--gold);
}

.profile-info { flex: 1; }
.profile-name { font-family: var(--font-display); font-size: 1.8rem; font-weight: 900; line-height: 1.1; color: var(--white); }
.profile-rating-row { display: flex; align-items: center; gap: 1rem; margin-top: 0.5rem; }
.profile-elo-big { font-family: var(--font-mono); font-size: 2rem; font-weight: 600; color: var(--white); }
.profile-elo-big.provisional { color: #ff9999; }
.profile-elo-big.official    { color: #88dd88; }
.profile-stats-row { display: flex; gap: 2rem; margin-top: 0.75rem; }
.profile-stat { text-align: center; }
.profile-stat-val { font-family: var(--font-mono); font-size: 1.4rem; font-weight: 600; color: var(--white); }
.profile-stat-label { font-size: 0.75rem; color: rgba(255,255,255,0.4); letter-spacing: 0.08em; text-transform: uppercase; }

/* ── Game History ── */
.history-list { display: flex; flex-direction: column; gap: 0.5rem; }

.history-entry {
  background: #1a1a2e;
  border: 1px solid rgba(255,255,255,0.06);
  border-left: 4px solid var(--club-primary);
  border-radius: var(--radius);
  padding: 0.8rem 1.25rem;
  display: grid;
  grid-template-columns: 80px 1fr 100px 80px 80px;
  align-items: center;
  gap: 1rem;
  transition: all 0.15s;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.history-entry:hover { border-color: rgba(255,255,255,0.15); background: #1f1f38; }

.history-result {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: center;
  padding: 0.3rem 0.6rem;
  border-radius: 5px;
}
.history-result.win  { background: rgba(30,200,100,0.12); color: #88dd88; }
.history-result.loss { background: rgba(192,19,44,0.12);  color: #ff8888; }
.history-result.draw { background: rgba(201,168,76,0.12); color: var(--gold); }

.history-opponent { font-family: var(--font-display); font-weight: 600; color: var(--white); }
.history-tc   { font-family: var(--font-mono); font-size: 0.8rem; color: rgba(255,255,255,0.35); }
.history-date { font-size: 0.78rem; color: rgba(255,255,255,0.25); }

.history-elo-change { font-family: var(--font-mono); font-weight: 600; text-align: right; }
.history-elo-change.positive { color: #88dd88; }
.history-elo-change.negative { color: #ff8888; }
.history-elo-change.neutral  { color: var(--gold); }

/* ── Achievements ── */
.achievements-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.75rem; }

.achievement-badge {
  background: rgba(201,168,76,0.08);
  border: 1px solid var(--gold);
  color: var(--gold);
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 0.82rem;
  text-align: center;
}
.achievement-badge-locked {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.2);
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 0.82rem;
  text-align: center;
}

/* ── Promotion Modal ── */
.promotion-choices {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin: 1.5rem 0;
}
.promotion-choice {
  background: rgba(255,255,255,0.05);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 1rem;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
  font-size: 2.5rem;
}
.promotion-choice:hover {
  border-color: var(--club-primary);
  background: rgba(255,255,255,0.1);
  transform: translateY(-3px);
}

/* ── Section headers ── */
.section-header {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: rgba(255,255,255,0.5);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ── Toast notifications ── */
.toast-container {
  position: fixed;
  top: 80px;
  right: 1.5rem;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: #1a1a2e;
  color: var(--white);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
  border-left: 4px solid var(--gold);
  animation: toastIn 0.3s ease;
  pointer-events: auto;
}
.toast.error   { border-left-color: #cc2222; }
.toast.success { border-left-color: #2a8b2a; }

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* ── Announcements ── */
.announcements-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}
.announcement-badge {
  background: var(--club-primary);
  color: #fff;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 700;
}
.announcement-item {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.6rem;
}
.announcement-item.unseen {
  border-color: rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06);
}
.announcement-title { font-weight: 600; color: var(--white); font-size: 0.9rem; margin-bottom: 0.35rem; }
.announcement-body  { color: rgba(255,255,255,0.5); font-size: 0.85rem; line-height: 1.5; }

/* ── Mobile bottom nav bar ── */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #0d0d1a;
  border-top: 2px solid var(--club-primary);
  z-index: 150;
  padding: 0.5rem 0 env(safe-area-inset-bottom, 0.5rem);
}
.mobile-nav-inner { display: flex; justify-content: space-around; align-items: center; }
.mobile-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  background: none;
  border: none;
  color: rgba(255,255,255,0.4);
  font-family: var(--font-display);
  font-size: 0.55rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  transition: color 0.2s;
  min-width: 56px;
}
.mobile-nav-btn .mnav-icon { font-size: 1.3rem; line-height: 1; }
.mobile-nav-btn:hover, .mobile-nav-btn.active { color: var(--gold); }

/* ── Spinner ── */
.spinner {
  width: 40px; height: 40px;
  border: 3px solid rgba(255,255,255,0.08);
  border-top-color: var(--club-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 2rem auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Utility ── */
.text-center { text-align: center; }
.text-muted { color: rgba(255,255,255,0.35); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 1rem; }
.hidden { display: none !important; }

/* ── RESPONSIVE ── */
@media (max-width: 1024px) {
  .game-layout { gap: 1rem; }
  .player-name { font-size: 0.95rem; }
  .clock { font-size: 2rem; }
  .pgn-viewer { width: min(420px, 90vw); }
}

@media (max-width: 768px) {
  .mobile-nav { display: block; }
  .header-nav { display: none; }
  .nav-user { display: none !important; }
  #nav-guest { display: none !important; }
  .page { padding-bottom: 70px; }
  .header-inner { height: 56px; padding: 0 1rem; }
  .header-logo img { height: 34px; width: 34px; }
  .header-logo-text .school-name { font-size: 0.82rem; }
  .header-logo-text .chess-label { font-size: 0.65rem; }
  .header-atomic { width: 34px; height: 34px; }
  .landing-hero { padding: 2rem 1.25rem; min-height: calc(100vh - 56px); }
  .landing-content { padding: 1.75rem 1.25rem 2rem; border-radius: 16px; }
  .landing-hero-row { gap: 3vw; margin-bottom: 1.25rem; flex-wrap: nowrap; justify-content: space-between; width: 100%; }

  .landing-element-card { width: 22vw; height: 30vw; max-width: 105px; max-height: 145px; border-radius: 10px; }

  .landing-element-number { font-size: 0.7rem; }
  .landing-element-symbol { font-size: clamp(1.6rem, 7vw, 3.5rem); margin-top: 10px; }
  .landing-element-name { font-size: clamp(0.42rem, 1.4vw, 0.7rem); }
  .landing-eoc-symbol { font-size: clamp(2rem, 8vw, 4rem); }
  .landing-school-logo { width: 22vw; height: 22vw; max-width: 100px; max-height: 100px; }
  .landing-title { font-size: clamp(1.1rem, 5.5vw, 2rem); white-space: normal; word-break: break-word; text-align: center; }
  .landing-title-sub { letter-spacing: 0.18em; font-size: clamp(0.78rem, 3vw, 1rem); margin-bottom: 1.5rem; text-align: center; }
  .landing-actions { grid-template-columns: 1fr 1fr; max-width: 340px; gap: 0.75rem; }
  .landing-actions .btn-primary.full-width { grid-column: 1 / -1; }
  .btn-primary, .btn-secondary { padding: 0.75rem 1rem; font-size: 0.78rem; }
  .dashboard { padding: 1.25rem 1rem; }
  .dashboard-header { flex-direction: column; margin-bottom: 1.25rem; }
  .dashboard-greeting { font-size: 1.4rem; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
  .stat-value { font-size: 1.5rem; }
  .stat-label { font-size: 0.6rem; }
  .dashboard-actions { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
  .action-card { padding: 1.25rem 1rem; }
  .action-card-icon { font-size: 1.5rem; margin-bottom: 0.5rem; }
  .action-card-title { font-size: 0.88rem; }
  .action-card-desc { font-size: 0.75rem; }
  .game-page { padding: 0.5rem; align-items: flex-start; min-height: calc(100vh - 56px); }
  .game-layout { grid-template-columns: 1fr; grid-template-rows: auto auto auto; gap: 0.6rem; width: 100%; }
  .game-layout > div:nth-child(1) { order: 1; }
  .game-layout > div:nth-child(2) { order: 2; }
  .game-layout > div:nth-child(3) { order: 3; }
  .player-panel { padding: 0.6rem 0.85rem; display: flex; align-items: center; justify-content: space-between; flex-direction: row; gap: 0.5rem; border-radius: var(--radius); }
  .player-color-badge { display: none; }
  .player-name { font-size: 0.88rem; margin-bottom: 0; }
  .player-elo { font-size: 0.75rem; }
  .clock { font-size: 1.6rem; padding: 0.4rem 0.75rem; margin-top: 0; min-width: 90px; text-align: center; }
  .board-container { width: 100%; align-items: center; }
  .pgn-viewer { width: var(--board-size, calc(100vw - 1rem)); max-width: 100%; }
  .pgn-moves { max-height: 80px; }
  .game-layout > div:nth-child(1) > div:nth-child(2) { display: none; }
  .game-layout > div:nth-child(3) > div:nth-child(2) { padding: 0.6rem 0.75rem; }
  .game-layout > div:nth-child(1) > div:nth-child(2) { display: none; }
  .game-layout > div:nth-child(3) > div:nth-child(2) { padding: 0.6rem 0.75rem; }
  .game-controls { flex-direction: row; flex-wrap: wrap; gap: 0.4rem; }
  .game-controls .btn-danger,
  .game-controls .btn-outline,
  .game-controls .btn-success { flex: 1; min-width: 80px; padding: 0.5rem 0.5rem; font-size: 0.7rem; }
  .leaderboard-page { padding: 1.25rem 1rem; }
  .leaderboard-header img { height: 40px; width: 40px; }
  .leaderboard-title { font-size: 1.4rem; }
  .leaderboard-table th,
  .leaderboard-table td { padding: 0.7rem 0.6rem; font-size: 0.8rem; }
  .leaderboard-table th:nth-child(5), .leaderboard-table td:nth-child(5),
  .leaderboard-table th:nth-child(6), .leaderboard-table td:nth-child(6) { display: none; }
  .profile-page { padding: 1.25rem 1rem; }
  .profile-header-card { flex-direction: column; text-align: center; padding: 1.25rem; gap: 1rem; }
  .profile-stats-row { justify-content: center; flex-wrap: wrap; gap: 1rem; }
  .profile-name { font-size: 1.4rem; }
  .profile-elo-big { font-size: 1.6rem; }
  .history-entry { grid-template-columns: 65px 1fr auto; gap: 0.5rem; padding: 0.65rem 0.75rem; }
  .history-tc, .history-date { display: none; }
  .achievements-grid { grid-template-columns: repeat(2, 1fr); }
  .modal { padding: 1.5rem; margin: 0.5rem; max-height: 90vh; overflow-y: auto; }
  .modal-title { font-size: 1.2rem; }
  .room-code-display { font-size: 2rem; letter-spacing: 0.15em; }
  .time-control-grid { grid-template-columns: repeat(3, 1fr); }
  .promotion-choices { gap: 0.5rem; }
  .promotion-choice { font-size: 2rem; padding: 0.75rem; }
  .auth-page { padding: 1rem; align-items: flex-start; padding-top: 2rem; }
  .form-container { padding: 1.75rem 1.25rem; }
  #pgn-review-board { width: 260px !important; }
}

@media (max-width: 390px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .landing-actions { grid-template-columns: 1fr; max-width: 260px; }
  .landing-actions .btn-primary.full-width { grid-column: 1; }
  .leaderboard-table th:nth-child(4), .leaderboard-table td:nth-child(4) { display: none; }
  .history-entry { grid-template-columns: 55px 1fr auto; }
  #pgn-review-board { width: 220px !important; }
}
