:root {
  --bg: #f8f9fb;
  --text: #1f2937;
  --muted: #6b7280;
  --accent: #0ea5e9;
  --card: #ffffff;
  --border: #e5e7eb;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, 'Helvetica Neue', Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

header {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}

nav {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

nav a {
  color: var(--text);
  text-decoration: none;
  padding: .5rem .75rem;
  border-radius: .5rem;
  border: 1px solid var(--border);
  background: #fff;
}

nav a:hover {
  border-color: var(--accent);
}

main {
  max-width: 1000px;
  margin: 2rem auto;
  padding: 0 1rem;
}

h1 {
  font-size: 1.8rem;
  margin: .5rem 0 1rem;
}

h2 {
  font-size: 1.3rem;
  margin: 1.5rem 0 .75rem;
}

figure {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 1rem;
  border-radius: .75rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--border);
}

th,
td {
  padding: .5rem;
  border-top: 1px solid var(--border);
  text-align: left;
}

footer {
  padding: 2rem 1rem;
  border-top: 1px solid var(--border);
  margin-top: 3rem;
  color: var(--muted);
}

.small {
  color: var(--muted);
  font-size: .92rem;
}

.notice {
  padding: 1rem;
  background: #eef6ff;
  border: 1px solid #cfe8ff;
  border-radius: .5rem;
}

.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.battery {
  width: 240px;
  height: 100px;
  border: 4px solid #333;
  position: relative;
  border-radius: 8px;
  background: #fff;
}

.battery::after {
  content: "";
  position: absolute;
  right: -18px;
  top: 28px;
  width: 12px;
  height: 44px;
  background: #333;
  border-radius: 2px;
}

.level {
  height: 100%;
  width: 60%;
  transition: width 1s linear;
  background: linear-gradient(90deg, #22c55e, #f59e0b, #ef4444);
}

.legend {
  display: flex;
  gap: .5rem;
  align-items: center;
  font-size: .9rem;
  color: #374151;
}

.legend span {
  display: inline-block;
  height: 10px;
  width: 30px;
  border: 1px solid #0003;
}

@media (max-width: 600px) {
  canvas {
    max-width: 100%;
    height: auto;
  }
}

/* Robot décoratif : conteneur FIXE (pas animé) */
.robot-side {
  position: fixed;
  right: 22px;
  bottom: 26px;
  width: 200px;
  pointer-events: none;
  z-index: 10;
  contain: paint;
  -webkit-transform: translateZ(0);
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, .12));
  opacity: .95;
}

/* On ANIME uniquement l’IMAGE pour éviter les glitches au scroll */
.robot-side img {
  display: block;
  width: 100%;
  height: auto;
  transform-origin: 50% 100%;
  animation: robot-float 6s ease-in-out infinite;
  will-change: transform;
}

/* Flottement doux */
@keyframes robot-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

/* grand écran */
@media (min-width: 1200px) {
  .robot-side {
    width: 230px;
    right: 28px;
    bottom: 32px;
  }
}

/* mobile : masquer si ça gêne */
@media (max-width: 800px) {
  .robot-side {
    display: none;
  }
}

/* accessibilité : pas d’anim si préférence réduite */
@media (prefers-reduced-motion: reduce) {
  .robot-side img {
    animation: none;
  }
}

/* Barres animées (hybride) */
.svg-bars .bar {
  transition: height 900ms ease-out, y 900ms ease-out;
}

.svg-bars .axis line {
  stroke: #e5e7eb;
}

.svg-bars text {
  fill: #6b7280;
  font: 500 12px/1 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, 'Helvetica Neue', Arial;
}

.btn-ia {
  display: inline-block;
  padding: .6rem 1.1rem;
  background: var(--accent);
  color: #fff;
  border-radius: .5rem;
  text-decoration: none;
  font-weight: 500;
  transition: background .2s ease;
}

.btn-ia:hover {
  background: #0284c7;
}
