:root {
  --fond: #0d1117;
  --carte: #161b22;
  --carte-hover: #1c2330;
  --texte: #e6edf3;
  --doux: #8b949e;
  --herbe: #3fb950;
  --herbe-hover: #56d364;
  --terre: #8a5a36;
  --ligne: #30363d;
  --accent: #58a6ff;
  --danger: #f85149;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0, 0, 0, .3);
  --transition: .2s ease;
}

@media (prefers-color-scheme: light) {
  :root {
    --fond: #f6f8fa;
    --carte: #ffffff;
    --carte-hover: #f3f4f6;
    --texte: #1f2328;
    --doux: #59636e;
    --ligne: #d1d9e0;
    --shadow: 0 4px 16px rgba(0, 0, 0, .08);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--fond);
  color: var(--texte);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--ligne) 1px, transparent 1px),
    linear-gradient(90deg, var(--ligne) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: .15;
  pointer-events: none;
  z-index: 0;
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 20px 64px;
  position: relative;
  z-index: 1;
}

/* Navigation */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 17, 23, .85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--ligne);
}

@media (prefers-color-scheme: light) {
  .nav { background: rgba(246, 248, 250, .85); }
}

.nav-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--texte);
  font-weight: 700;
  font-size: 1.05rem;
}

.nav-cube {
  width: 24px;
  height: 24px;
  border-radius: 3px;
  background: linear-gradient(var(--herbe) 0 30%, var(--terre) 30% 100%);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .15);
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 4px;
  align-items: center;
}

.nav-links a {
  display: block;
  padding: 8px 14px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--doux);
  font-size: .9rem;
  font-weight: 500;
  transition: all var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--texte);
  background: var(--carte);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--texte);
  border-radius: 2px;
  transition: all var(--transition);
}

/* Hero */
.hero { text-align: center; margin-bottom: 48px; padding-top: 32px; }

.logo-container { perspective: 400px; margin-bottom: 24px; }

.logo-cube {
  width: 80px;
  height: 80px;
  margin: 0 auto;
  position: relative;
  transform-style: preserve-3d;
  animation: cube-float 4s ease-in-out infinite;
}

.cube-face {
  position: absolute;
  width: 80px;
  height: 80px;
  border-radius: 4px;
}

.cube-top {
  background: var(--herbe);
  transform: rotateX(90deg) translateZ(40px);
}

.cube-front {
  background: linear-gradient(var(--herbe) 0 30%, var(--terre) 30% 100%);
  transform: translateZ(40px);
  box-shadow: inset 0 -8px 0 rgba(0, 0, 0, .15);
}

.cube-side {
  background: linear-gradient(var(--herbe) 0 30%, var(--terre) 30% 100%);
  transform: rotateY(90deg) translateZ(40px);
  filter: brightness(.85);
}

@keyframes cube-float {
  0%, 100% { transform: rotateX(-15deg) rotateY(25deg) translateY(0); }
  50% { transform: rotateX(-15deg) rotateY(25deg) translateY(-8px); }
}

h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.tagline {
  color: var(--doux);
  font-size: 1.05rem;
  margin-bottom: 20px;
}

/* Cartes */
.card {
  background: var(--carte);
  border: 1px solid var(--ligne);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  transition: border-color var(--transition), background var(--transition);
}

.card:hover { border-color: var(--doux); }

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.card-header .icon {
  width: 20px;
  height: 20px;
  color: var(--herbe);
  flex-shrink: 0;
}

h2 { font-size: 1.1rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }

.card-desc { color: var(--doux); margin-bottom: 16px; }

/* Liste */
.list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--fond);
  border: 1px solid var(--ligne);
  border-radius: 8px;
}

.list li .icon {
  width: 16px;
  height: 16px;
  color: var(--accent);
  flex-shrink: 0;
}

/* Règles */
.rules-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rules-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.icon-check {
  width: 18px;
  height: 18px;
  color: var(--herbe);
  flex-shrink: 0;
  margin-top: 2px;
}

/* Onglets */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--ligne);
  padding-bottom: 0;
  overflow-x: auto;
}

.tab {
  padding: 10px 18px;
  border: none;
  background: none;
  color: var(--doux);
  font: 600 .9rem system-ui, sans-serif;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: all var(--transition);
}

.tab:hover { color: var(--texte); }

.tab.active {
  color: var(--herbe);
  border-bottom-color: var(--herbe);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--ligne);
  margin-top: 64px;
  padding: 40px 20px 24px;
  position: relative;
  z-index: 1;
}

.footer-inner {
  max-width: 960px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  margin-bottom: 32px;
}

.footer-col h4 {
  font-size: .9rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.footer-col p {
  color: var(--doux);
  font-size: .85rem;
}

.footer-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-col a {
  color: var(--doux);
  text-decoration: none;
  font-size: .85rem;
  transition: color var(--transition);
}

.footer-col a:hover { color: var(--texte); }

.footer-bottom {
  max-width: 960px;
  margin: 0 auto;
  padding-top: 24px;
  border-top: 1px solid var(--ligne);
  text-align: center;
  color: var(--doux);
  font-size: .8rem;
}

@media (max-width: 768px) {
  .footer-inner { grid-template-columns: 1fr; }
}

/* Animations d'entrée */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero { animation: fade-up .5s ease both; }
.card:nth-of-type(1) { animation: fade-up .5s ease .1s both; }
.card:nth-of-type(2) { animation: fade-up .5s ease .2s both; }
.card:nth-of-type(3) { animation: fade-up .5s ease .3s both; }
footer { animation: fade-up .5s ease .4s both; }

/* Responsive nav */
@media (max-width: 768px) {
  .nav-toggle { display: flex; }

  .nav-links {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--fond);
    border-bottom: 1px solid var(--ligne);
    padding: 16px 20px;
    gap: 4px;
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
  }

  .nav-links.open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  h1 { font-size: 2rem; }
}
