:root {
  --primary: #0056b3;
  --primary-dark: #004094;
  --accent: #ff6b00;
  --accent-hover: #e65e00;
  --dark: #0f172a;
  --darker: #020617;
  --light: #f8fafc;
  --text: #334155;
  --text-light: #64748b;
  --border: #e2e8f0;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
  --sidebar-width: 300px;
  --max-width: 1280px;
}

* {
  box-sizing: border-box;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--light);
  color: var(--text);
  margin: 0;
  line-height: 1.7;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

a {
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
}

img {
  max-width: 100%;
  height: auto;
}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ============================================
   HEADER
============================================ */
header {
  background: white;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 999;
  padding: 12px 0;
  box-shadow: var(--shadow);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.logo-img {
  height: 42px;
  width: auto;
  display: block;
}

.fallback-logo {
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--dark);
  display: none;
}

.desktop-nav {
  display: none;
  gap: 30px;
}

@media (min-width: 900px) {
  .desktop-nav {
    display: flex;
  }

  .desktop-nav a {
    font-weight: 600;
    color: var(--text);
    font-size: 0.95rem;
    position: relative;
  }

  .desktop-nav a::after {
    content: "";
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width 0.2s;
  }

  .desktop-nav a:hover::after,
  .desktop-nav a.active::after {
    width: 100%;
  }

  .desktop-nav a:hover,
  .desktop-nav a.active {
    color: var(--primary);
  }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}

.login-link {
  font-weight: 600;
  color: var(--text);
  display: none;
}

@media (min-width: 600px) {
  .login-link {
    display: block;
  }
  .login-link:hover {
    color: var(--primary);
  }
}

.cta-button {
  background: var(--accent);
  color: white;
  padding: 10px 24px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.9rem;
  text-transform: uppercase;
  display: inline-block;
  text-align: center;
  box-shadow: 0 2px 8px rgba(255, 107, 0, 0.3);
}

.cta-button:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 107, 0, 0.4);
}

.cta-button.large {
  padding: 15px 40px;
  font-size: 1.1rem;
}

/* ============================================
   HERO SECTION
============================================ */
.hero-game {
  background: linear-gradient(135deg, var(--dark) 0%, #1e293b 100%);
  padding: 80px 0;
  position: relative;
  overflow: hidden;
}

.hero-game::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 120"><path d="M0,0V46.29c47.79,22.2,103.59,32.17,158,28,70.36-5.37,136.33-33.31,206.8-37.5C438.64,32.43,512.34,53.67,583,72.05c69.27,18,138.3,24.88,209.4,13.08,36.15-6,69.85-17.84,104.45-29.34C989.49,25,1113-14.29,1200,52.47V0Z" opacity=".1" fill="%23fff"/></svg>')
    no-repeat bottom;
  background-size: cover;
  opacity: 0.05;
  pointer-events: none;
}

.hero-content-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
  position: relative;
}

@media (max-width: 968px) {
  .hero-content-wrapper {
    grid-template-columns: 1fr;
    gap: 40px;
  }
}

.hero-text {
  color: white;
}

.hero-text h1 {
  font-size: clamp(2.5rem, 5vw, 3.8rem);
  margin: 0 0 20px;
  line-height: 1.1;
  letter-spacing: -1px;
  font-weight: 800;
}

.hero-text .subtitle {
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  color: #94a3b8;
  margin-bottom: 30px;
  line-height: 1.5;
}

.game-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 40px;
}

.game-badges .badge {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  padding: 10px 20px;
  border-radius: 30px;
  font-size: 0.9rem;
  font-weight: 600;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.hero-cta {
  margin-top: 30px;
}

.btn-hero {
  display: inline-block;
  background: var(--accent);
  color: white;
  padding: 18px 45px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 8px 25px rgba(255, 107, 0, 0.4);
  transition: all 0.3s ease;
}

.btn-hero:hover {
  background: var(--accent-hover);
  transform: translateY(-3px);
  box-shadow: 0 12px 35px rgba(255, 107, 0, 0.5);
}

.hero-visual {
  position: relative;
}

.hero-image-wrapper {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
  border: 3px solid rgba(255, 255, 255, 0.1);
}

.hero-image-wrapper img {
  width: 100%;
  height: auto;
  display: block;
}

.quick-stats {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 30px;
  margin-top: 30px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 25px;
}

@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

.stat-item {
  text-align: center;
  padding: 15px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-label {
  display: block;
  font-size: 0.85rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
  font-weight: 600;
}

.stat-value {
  display: block;
  font-size: 1.4rem;
  color: white;
  font-weight: 800;
}

.stat-item.highlight .stat-value {
  color: var(--accent);
}

/* ============================================
   MAIN CONTENT LAYOUT
============================================ */
.main-content-layout,
.content-wrapper {
  display: flex;
  gap: 50px;
  padding-top: 60px;
  padding-bottom: 80px;
  align-items: flex-start;
}

@media (max-width: 1023px) {
  .main-content-layout,
  .content-wrapper {
    flex-direction: column;
  }
}

/* ============================================
   TOC SIDEBAR
============================================ */
.toc-sidebar,
.sidebar {
  width: var(--sidebar-width);
  position: sticky;
  top: 100px;
  background: white;
  padding: 25px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: none;
}

@media (min-width: 1024px) {
  .toc-sidebar,
  .sidebar {
    display: block;
  }
}

.toc-sidebar h3,
.sidebar .toc h3 {
  margin-top: 0;
  font-size: 1.1rem;
  border-bottom: 2px solid var(--primary);
  padding-bottom: 10px;
  margin-bottom: 15px;
}

.toc-sidebar nav ul,
.sidebar .toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-sidebar nav li,
.sidebar .toc li {
  margin-bottom: 12px;
}

.toc-sidebar nav a,
.sidebar .toc a {
  color: var(--text-light);
  font-size: 0.95rem;
  font-weight: 500;
  display: block;
  padding: 4px 0;
  transition: all 0.2s;
}

.toc-sidebar nav a:hover,
.sidebar .toc a:hover {
  color: var(--primary);
  padding-left: 8px;
}

/* ============================================
   ARTICLE CONTENT
============================================ */
.long-read,
.main-content {
  flex: 1;
  max-width: 100%;
  background: white;
  padding: 40px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

@media (max-width: 768px) {
  .long-read,
  .main-content {
    padding: 25px 20px;
  }
}

.long-read section,
.main-content section {
  margin-bottom: 60px;
  scroll-margin-top: 100px;
}

.long-read h2,
.main-content h2 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  color: var(--dark);
  border-bottom: 3px solid var(--primary);
  padding-bottom: 15px;
  margin-bottom: 30px;
  line-height: 1.3;
}

.long-read h3,
.main-content h3 {
  font-size: clamp(1.3rem, 2.5vw, 1.7rem);
  color: var(--text);
  margin-top: 40px;
  margin-bottom: 20px;
}

.long-read h4,
.main-content h4 {
  font-size: 1.2rem;
  color: var(--dark);
  margin-top: 25px;
  margin-bottom: 15px;
}

.long-read p,
.main-content p {
  margin-bottom: 20px;
  font-size: 1.05rem;
  line-height: 1.8;
}

/* Info Grid */
.info-grid,
.key-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 25px;
  margin: 30px 0;
}

.info-card,
.feature-card {
  background: #f8fafc;
  padding: 25px;
  border-radius: var(--radius);
  border-left: 4px solid var(--primary);
}

.info-card h3,
.feature-card h3 {
  margin-top: 0;
  font-size: 1.2rem;
  color: var(--dark);
}

/* Step by Step */
.step-by-step,
.rules-grid {
  margin: 30px 0;
}

.step,
.rule-step {
  display: flex;
  gap: 20px;
  margin-bottom: 30px;
  padding: 20px;
  background: #f8fafc;
  border-radius: var(--radius);
  border-left: 4px solid var(--primary);
}

.step-number {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.2rem;
}

/* ============================================
   TABLES (ONE SIMPLE SYSTEM)
   - All tables stay tables
   - All tables scroll horizontally on small screens
============================================ */

/* Wrapper: ALWAYS does the scrolling */
.table-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 30px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-lg);
}

/* Default: tables fill wrapper */
.data-table,
.specs-table,
.platform-table,
.requirements-table,
.mini-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

/* Captions */
.data-table caption,
.specs-table caption,
.platform-table caption,
.requirements-table caption,
.mini-table caption {
  font-weight: 600;
  margin: 12px 12px 0;
  padding-bottom: 8px;
  text-align: left;
}

/* Header rows */
.data-table thead,
.specs-table thead,
.platform-table thead,
.requirements-table thead,
.mini-table thead {
  background: var(--dark);
  color: #fff;
}

/* Cells */
.data-table th,
.data-table td,
.specs-table th,
.specs-table td,
.platform-table th,
.platform-table td,
.requirements-table th,
.requirements-table td,
.mini-table th,
.mini-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  font-size: 0.95rem;
  white-space: nowrap; /* keeps columns readable */
}

.data-table tbody tr:hover,
.specs-table tbody tr:hover,
.platform-table tbody tr:hover,
.requirements-table tbody tr:hover {
  background: #f8fafc;
}

/* Make sure scroll actually triggers on mobile */
.data-table {
  min-width: 760px;
}
.platform-table {
  min-width: 760px;
}
.specs-table {
  min-width: 560px;
}
.requirements-table {
  min-width: 640px; /* important: forces scroll on phones */
}

/* Mobile tweaks (still table, just smaller padding) */
@media (max-width: 768px) {
  .data-table th,
  .data-table td,
  .specs-table th,
  .specs-table td,
  .platform-table th,
  .platform-table td,
  .requirements-table th,
  .requirements-table td {
    padding: 12px 14px;
    font-size: 0.9rem;
  }

  /* Allow caption to wrap */
  .data-table caption,
  .specs-table caption,
  .platform-table caption,
  .requirements-table caption {
    white-space: normal;
  }
}

/* ============================================
   BADGES
============================================ */
.badge,
.mode-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
}

.mode-badge.easy {
  background: var(--success);
  color: white;
}
.mode-badge.medium {
  background: var(--warning);
  color: white;
}
.mode-badge.hard {
  background: var(--accent);
  color: white;
}
.mode-badge.hardcore {
  background: var(--danger);
  color: white;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
============================================ */
@media (max-width: 768px) {
  .hero-game {
    padding: 60px 0;
  }

  .game-badges {
    gap: 8px;
  }

  .game-badges .badge {
    padding: 8px 14px;
    font-size: 0.8rem;
  }

  .btn-hero {
    padding: 15px 35px;
    font-size: 1rem;
  }

  .quick-stats {
    padding: 20px;
  }

  .step,
  .rule-step {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .header-content {
    flex-wrap: wrap;
  }

  .cta-button {
    padding: 8px 16px;
    font-size: 0.8rem;
  }

  .hero-text h1 {
    font-size: 2rem;
  }

  .btn-hero {
    padding: 12px 28px;
    font-size: 0.9rem;
  }

  .stat-value {
    font-size: 1.2rem;
  }
}

/* Footer Styles */
footer {
  background: #1a1a2e;
  color: #e0e0e0;
  padding: 60px 20px 30px;
  margin-top: 80px;
}

footer .container {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 40px;
  margin-bottom: 40px;
}

.footer-col h4 {
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  border-bottom: 2px solid #4a90e2;
  padding-bottom: 8px;
}

.footer-col p {
  color: #b0b0b0;
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 12px;
}

.footer-col p strong {
  color: #fff;
}

.footer-col a {
  display: block;
  color: #b0b0b0;
  text-decoration: none;
  font-size: 14px;
  padding: 6px 0;
  transition: color 0.3s ease, padding-left 0.3s ease;
}

.footer-col a:hover {
  color: #4a90e2;
  padding-left: 8px;
}

.footer-bottom {
  border-top: 1px solid #2d2d44;
  padding-top: 24px;
  text-align: center;
}

.footer-bottom p {
  color: #8a8a8a;
  font-size: 14px;
  margin-bottom: 12px;
  line-height: 1.6;
}

.footer-bottom a {
  color: #4a90e2;
  text-decoration: none;
}

.footer-bottom a:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
  footer {
    padding: 40px 20px 20px;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .footer-col h4 {
    font-size: 16px;
  }

  .footer-bottom p {
    font-size: 13px;
  }
}