* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: system-ui, sans-serif;
  background: #0f1020;
  color: #ecedf7;
}
main { max-width: 960px; margin: 0 auto; padding: 24px 16px; }
header { text-align: center; }
h1 { margin: 0; color: var(--accent); font-size: 2.2rem; }
h2 { margin-top: 0; font-size: 1.05rem; }

#arena {
  position: relative;
  overflow: hidden;
  margin: 16px 0;
  border: 1px solid #2b2d4d;
  border-radius: 16px;
  background: #16172c;
  touch-action: none;
}
.grade {
  position: absolute;
  padding: 0;
  border-radius: 50%;
  border: 2px solid #44476e;
  background: #22243f;
  color: inherit;
  font-family: system-ui, sans-serif;
  font-weight: 700;
  user-select: none;
}
.grade.bad {
  pointer-events: none; /* intouchable, même si la souris la rattrape */
  transition: left .12s ease-out, top .12s ease-out, opacity .1s, transform .1s;
}
.grade.good {
  z-index: 1; /* une note fuyante ne masque jamais une bonne note */
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  animation: glow 1.8s ease-in-out infinite;
  transition: left .18s ease-out, top .18s ease-out, transform .1s;
}
.grade.good:hover, .grade.good:focus-visible { transform: scale(1.1); outline: 3px solid #fff; }
@keyframes glow {
  50% { box-shadow: 0 0 22px var(--accent); }
}
@media (prefers-reduced-motion: reduce) {
  .grade { animation: none !important; transition: none !important; }
}

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.stats div, .card {
  background: #16172c;
  border: 1px solid #2b2d4d;
  border-radius: 12px;
  padding: 16px;
}
.stats div { text-align: center; color: #a7a9c9; }
.stats span { display: block; font-size: 2rem; font-weight: 700; color: #fff; }

.columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.columns { margin-top: 16px; align-items: start; }
.card + .card { margin-top: 16px; }
.columns > div > .card:first-child { margin-top: 0; }
#history { list-style: none; margin: 0; padding: 0; }
#history li { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid #2b2d4d; }
#history li div { min-width: 0; overflow-wrap: anywhere; }
#history p { margin: 4px 0; }
small { color: #a7a9c9; }
.badge {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
}
code { overflow-wrap: anywhere; }
dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; }
dt { font-family: ui-monospace, monospace; color: #a7a9c9; }
dd { margin: 0; overflow-wrap: anywhere; }
.swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 6px;
  background: var(--accent);
}

.banner { padding: 10px 14px; border-radius: 8px; background: #5c1f2c; }
.banner.success { background: #17503a; }

dialog {
  width: min(420px, 92vw);
  border: 1px solid var(--accent);
  border-radius: 16px;
  background: #16172c;
  color: inherit;
}
dialog::backdrop { background: #000a; }
label { display: block; margin-bottom: 12px; }
input, textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px;
  border: 1px solid #44476e;
  border-radius: 8px;
  background: #0f1020;
  color: inherit;
  font: inherit;
}
menu { display: flex; justify-content: flex-end; gap: 8px; margin: 0; padding: 0; }
menu button {
  padding: 8px 16px;
  border: 1px solid #44476e;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
menu .primary { background: var(--accent); border-color: var(--accent); color: #fff; }
