/* MOT-BARRE WIDGET V2 — fichier corrigé */
.mot-barre-widget {
  --mot-barre-blue: #147e99;
  --mot-barre-blue-dark: #0f6d86;
  --mot-barre-blue-ink: #0f4c5c;
  --mot-barre-green: #06752c;
  --mot-barre-green-bg: #e7f8ed;
  --mot-barre-red: #d64545;
  --mot-barre-yellow: #ffb913;
  --mot-barre-yellow-bg: #fff5bf;
  --mot-barre-border: #cfd9e6;
  max-width: 680px;
  margin: 20px auto;
  color: #17212b;
  font-family: Arial, system-ui, sans-serif;
}

.mot-barre-widget *,
.mot-barre-widget *::before,
.mot-barre-widget *::after {
  box-sizing: border-box;
}

.mb-grid {
  display: grid;
  grid-template-areas:
    "item1 item3" 
    "item2 .    ";
  gap: 10px;
  align-items: center;
}

@media (max-width: 780px) {
  .mb-grid {
    display: grid;
    grid-template-areas:
    "item1" "item2" "item3";
    justify-items: center;
  }
}

.mot-barre-grid {
  grid-area: item1;
  width: min(100%, 260px);
  margin: 0 auto;
  padding: 8px;
  border: 2px solid var(--mot-barre-border);
  border-radius: 10px;
  background: #fff;
}

.mot-barre-row {
  display: grid;
  grid-template-columns: repeat(var(--mot-barre-cols), minmax(0, 1fr));
  gap: 3px;
}

.mot-barre-row + .mot-barre-row {
  margin-top: 3px;
}

.mot-barre-cell {
  display: grid;
  min-width: 0;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 4px;
  background: #f0f3f6;
  color: var(--mot-barre-blue-ink);
  font-size: clamp(11px, 2.4vw, 16px);
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
}

.mot-barre-cell.is-found {
  background: var(--mot-barre-green-bg);
  color: var(--mot-barre-green);
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.mot-barre-cell.is-solution {
  background: var(--mot-barre-yellow-bg);
  color: #6a4d08;
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.mot-barre-answers {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
  grid-area: item2;
}

.mot-barre-answer {
  display: inline-flex;
  min-width: 34px;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  border: 1px solid var(--mot-barre-border);
  border-radius: 999px;
  background: #f0f3f6;
  color: var(--mot-barre-blue-ink);
  font-weight: 700;
}

.mot-barre-answer.is-found {
  border-color: var(--mot-barre-green);
  background: var(--mot-barre-green-bg);
  color: var(--mot-barre-green);
}

.mot-barre-answer.is-found::before {
  content: "✓";
  margin-right: 6px;
}

.mot-barre-answer.is-solution {
  border-color: var(--mot-barre-yellow);
  background: var(--mot-barre-yellow-bg);
  color: #6a4d08;
}

.mot-barre-entry {
  display: block;
  margin-top: 14px;
}

.mot-barre-field {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  color: var(--mot-barre-blue-ink);
  font-weight: 700;
}

.mot-barre-field > span {
  flex: 0 0 auto;
  white-space: nowrap;
}

.mot-barre-input {
  grid-area: item3;
  display: inline-block;
  box-sizing: border-box;
  flex: 0 1 20ch;
  width: 20ch;
  max-width: 280px!important;
  min-width: 0;
  padding: 5px 10px!important;
  border: 2px solid #cfd9e6!important;
  border-radius: 8px!important;
  outline: none;
  background: #fafcff!important;
  color: #0f172a!important;
  font: 400 1rem/1.5 Arial, system-ui, sans-serif!important;
}

.mot-barre-input:focus {
  border-color: #2b7bbb!important;
  background: #eef6ff!important;
}

.mot-barre-input.ok {
  border-color: #1aa34a;
  background: #eef9f1;
}

.mot-barre-input.ko {
  border-color: #d64545;
  background: #fff0f0;
}

.mot-barre-input.is-solution {
  border: 2px dashed #ffb913 !important;
  background: #fff5bf !important;
  color: #6a4d08 !important;
}

.mot-barre-input.is-missed {
  border: 2px dashed #d64545 !important;
  border-radius: 3px !important;
  background: transparent !important;
}

.mot-barre-check,
.mot-barre-actions button {
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid var(--mot-barre-blue-dark);
  border-radius: 8px;
  background: var(--mot-barre-blue);
  color: #fff;
  cursor: pointer;
  font: 400 16px/1.1 Arial, system-ui, sans-serif;
}

.mot-barre-check:hover:not(:disabled),
.mot-barre-actions button:hover:not(:disabled) {
  filter: brightness(0.95);
}

.mot-barre-check:disabled,
.mot-barre-actions button:disabled,
.mot-barre-input:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.mot-barre-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #e7eef6;
}

.mot-barre-actions .mot-barre-retry {
  border-color: var(--mot-barre-border);
  background: #f0f3f6;
  color: var(--mot-barre-blue-ink);
}

.mot-barre-actions .mot-barre-solution:hover:not(:disabled),
.mot-barre-actions .mot-barre-solution.is-active {
  border-color: var(--mot-barre-yellow);
  background: var(--mot-barre-yellow-bg);
  color: #6a4d08;
}

.mot-barre-score {
  margin-left: auto;
  padding: 8px 4px;
  color: var(--mot-barre-blue-ink);
  font-weight: 800;
}

.mot-barre-config-error {
  padding: 14px;
  border: 2px solid var(--mot-barre-red);
  border-radius: 10px;
  background: #fff0f0;
}

@media (max-width: 560px) {
  .mot-barre-grid {
    padding: 5px;
  }

  .mot-barre-row {
    gap: 2px;
  }

  .mot-barre-row + .mot-barre-row {
    margin-top: 2px;
  }

  .mot-barre-field {
    width: 100%;
  }

  .mot-barre-score {
    width: 100%;
    margin-left: 0;
    text-align: right;
  }
}
