* { box-sizing: border-box; }

:root{
  --bg: radial-gradient(circle at 35% 20%, #f7f1c8 0%, #e6dfb6 28%, #d3cda7 55%, #bdb792 100%);

  --card: rgba(255,255,255,.72);
  --muted:#475569;
  --text:#0f172a;
  --line: rgba(15,23,42,.18);

  --ok:#22c55e;
  --warn:#f59e0b;
  --bad:#ef4444;
}

html,body{
  margin:0;
  height:100%;
  background:var(--bg);
  color:var(--text);
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial;
}

#app{
  max-width: 980px;
  margin: 0 auto;
  padding: 14px;
  display:flex;
  flex-direction:column;
  gap:12px;
}

.top{
  display:flex;
  gap:12px;
  align-items:flex-end;
  justify-content:space-between;
  flex-wrap:wrap;
}

.brand .title{
  font-size:18px;
  font-weight:800;
  letter-spacing:.2px;
}

.brand .subtitle{
  margin-top:2px;
  font-size:13px;
  color:var(--muted);
}

.hud{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:stretch;
  justify-content:flex-end;
}

.hudItem{
  border:1px solid var(--line);
  background: rgba(255,255,255,.55);
  border-radius:12px;
  padding:8px 10px;
  min-width:140px;
}

.hudLabel{
  font-size:12px;
  color:var(--muted);
}

.hudValue{
  font-size:16px;
  font-weight:800;
  margin-top:2px;
}

.card{
  border:1px solid var(--line);
  background:var(--card);
  border-radius:16px;
  padding:14px;
  box-shadow: 0 10px 25px rgba(0,0,0,.18);
  display:flex;
  flex-direction:column;
  gap:12px;
}

.noteWrap{
  display:flex;
  align-items:center;
  justify-content:center;
  min-height: 240px;
  border:1px dashed rgba(15,23,42,.22);
  border-radius:14px;
  background: rgba(255,255,255,.60);
  padding:10px;
}

/* Grille des 10 notes */
.series{
  width: 100%;
  display:grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap:10px;
  align-items:stretch;
}

.slot{
  border:1px solid rgba(15,23,42,.18);
  background: rgba(255,255,255,.65);
  border-radius:12px;
  padding:8px;
  display:flex;
  align-items:center;
  justify-content:center;
  min-height: 98px;
  position:relative;
  overflow:hidden;
}

.slot .num{
  position:absolute;
  top:6px;
  left:8px;
  font-size:12px;
  font-weight:800;
  color: rgba(15,23,42,.55);
}

.noteImg{
  display:none; /* cachée tant que non chargée (évite “image cassée”) */
  max-width: 100%;
  max-height: 120px;
  width:auto;
  height:auto;
}

.noteImg.ready{ display:block; }

.fallback{
  font-size:14px;
  font-weight:800;
  color: rgba(15,23,42,.75);
  padding:8px;
}

/* Sur écran étroit : 2 colonnes */
@media (max-width: 640px){
  .series{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .slot{ min-height: 110px; }
  .noteImg{ max-height: 130px; }
}

.timer{
  height:10px;
  border-radius:999px;
  overflow:hidden;
  border:1px solid var(--line);
  background: rgba(255,255,255,.45);
}

.timer .bar{
  height:100%;
  width:0%;
  background: rgba(15,23,42,.35);
  transition: width .08s linear;
}

.feedback{
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.55);
  font-size:14px;
  line-height:1.35;
}

.controls{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

button{
  border:1px solid var(--line);
  background: rgba(255,255,255,.55);
  color:var(--text);
  padding:10px 12px;
  border-radius:12px;
  cursor:pointer;
  font-weight:700;
}

button:hover{ background: rgba(255,255,255,.72); }
button:active{ transform: translateY(1px); }

button.primary{
  background: rgba(34,197,94,.18);
  border-color: rgba(34,197,94,.35);
}

button:disabled{
  opacity:.55;
  cursor:not-allowed;
}

.transcript{
  border:1px solid var(--line);
  background: rgba(255,255,255,.55);
  border-radius:12px;
  padding:10px 12px;
}

.tLabel{
  font-size:12px;
  color:var(--muted);
}

.tValue{
  margin-top:3px;
  font-size:14px;
  font-weight:700;
  word-break:break-word;
}

.results{
  border:1px solid var(--line);
  background: rgba(255,255,255,.55);
  border-radius:12px;
  padding:10px 12px;
  display:flex;
  flex-direction:column;
  gap:8px;
}

.rTitle{
  font-weight:900;
}

.rLine{
  font-size:13px;
}

.rTableWrap{
  overflow:auto;
  border:1px solid rgba(15,23,42,.14);
  border-radius:10px;
  background: rgba(255,255,255,.50);
}

.rTable{
  width:100%;
  border-collapse:collapse;
  min-width: 420px;
}

.rTable th, .rTable td{
  border-bottom:1px solid rgba(15,23,42,.12);
  padding:8px 10px;
  text-align:left;
  font-size:13px;
}

.rTable th{
  font-size:12px;
  color: rgba(71,85,105,.95);
  background: rgba(255,255,255,.55);
  position:sticky;
  top:0;
}

.okCell{
  font-weight:900;
  color: rgba(34,197,94,.95);
}

.badCell{
  font-weight:900;
  color: rgba(239,68,68,.95);
}

.small{
  color:var(--muted);
  font-size:12px;
  line-height:1.35;
}
