/* Palette DA */
:root {
  --bg: #0d1117;
  --panel: #161b22;
  --border: #30363d;
  --text: #c9d1d9;
  --text-muted: #8b949e;
  --accent: #238636;
  --accent-glow: rgba(35, 134, 54, 0.15);
  --font-mono: 'Courier New', Courier, monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

html, body {
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  overflow: hidden;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  display: flex;
  flex-direction: column;
  align-items: center;
  user-select: none;
  padding: 10px;
}

header {
  width: 100%;
  max-width: 700px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
  flex-shrink: 0;
}

.logo {
  font-family: var(--font-mono);
  font-weight: bold;
  color: var(--accent);
  font-size: 1.1rem;
}

nav {
  display: flex;
  align-items: center;
}

nav a {
  color: var(--text-muted);
  text-decoration: none;
  margin-left: 20px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  transition: color 0.2s;
}

nav a.active, nav a:hover {
  color: var(--text);
  text-decoration: underline;
}

.lang-btn {
  border: 1px solid var(--border);
  padding: 2px 6px;
  margin-left: 10px;
  text-decoration: none;
}

/* Palier */
.notification-banner {
  position: absolute;
  top: 75px;
  background: var(--panel);
  border: 1px solid var(--accent);
  border-left: 4px solid var(--accent);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 10px 20px;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
  max-width: 90%;
  text-align: center;
}

.notification-banner.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.game-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 700px;
  flex-grow: 1;
}

#canvas-container {
  position: relative;
  width: 100%;
  max-width: 700px;
  aspect-ratio: 700 / 500;
  display: flex;
  flex-direction: column;
}

#ui {
  display: flex;
  gap: 20px;
  margin-bottom: 12px;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  justify-content: center;
  flex-shrink: 0;
}

#ui span {
  color: var(--accent);
  font-weight: bold;
}

canvas {
  width: 100% !important;
  height: 100% !important;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  background: var(--panel);
  cursor: pointer;
  display: block;
  touch-action: manipulation;
}

/* Menu + Game over */
.screen-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  padding: 30px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.8);
  text-align: center;
  width: 90%;
  max-width: 420px;
  z-index: 20;
}

#game-over {
  border-left-color: #f85149;
}

.screen-overlay h1, #game-over h2 {
  font-family: var(--font-mono);
  color: var(--accent);
  margin-bottom: 5px;
  font-size: 1.4rem;
}

#game-over h2 {
  color: #f85149;
}

.subtitle {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.rules-container {
  display: flex;
  gap: 15px;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 12px;
  margin-bottom: 15px;
  text-align: left;
}

.rules-text {
  font-size: 0.8rem;
  color: var(--text);
  line-height: 1.4;
  font-family: var(--font-sans);
}

.rules-text p {
  margin-bottom: 8px;
}

.rules-schema {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

.btn {
  display: inline-block;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--accent);
  padding: 10px 20px;
  font-family: var(--font-mono);
  text-decoration: none;
  margin-top: 15px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.btn:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
}

/* --- RESPONSIVE MOBILE (A refaire) --- */
@media (max-width: 768px) {
  html, body {
    padding: 0;
    margin: 0;
    justify-content: space-between;
    overflow: hidden;
  }

  header {
    max-width: 100%;
    padding: 8px 12px;
    margin-bottom: 0;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
  }

  .game-wrapper {
    max-width: 100%;
    height: 100%;
    flex-grow: 1;
    justify-content: center;
  }

  #canvas-container {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    aspect-ratio: auto !important;
    flex-grow: 1;
    border: none;
  }

  /* HUD mobile */
  #ui {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(22, 27, 34, 0.85);
    backdrop-filter: blur(4px);
    margin-bottom: 0;
    padding: 8px 10px;
    font-size: 0.8rem;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    z-index: 5;
    justify-content: space-around;
  }

  canvas {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    border-left: none !important;
    object-fit: contain;
  }

  .notification-banner {
    top: 55px;
    font-size: 0.75rem;
    padding: 8px 12px;
  }
  
  .screen-overlay {
    width: 92%;
    padding: 20px;
  }
}