/* Mots codés — a filled grid of numbered cells; pick a number, name its letter.
   Reuses the gap technique for clean grid lines. On the design-system paper. */

.mc-root { padding: clamp(6px, 2vw, 16px); max-inline-size: 440px; margin: 0 auto; color: var(--color-text); display: flex; flex-direction: column; gap: var(--space-4); align-items: center; }

.mc-grid {
  display: grid; grid-template-columns: repeat(var(--n), 1fr); grid-template-rows: repeat(var(--n), 1fr);
  inline-size: min(100%, 360px); aspect-ratio: 1; gap: 1px; background: var(--color-neutral-400);
  outline: 2px solid var(--color-neutral-400); outline-offset: 0; border-radius: 2px;
}
.mc-cell {
  position: relative; background: var(--color-neutral-100); display: flex; align-items: center; justify-content: center; cursor: pointer;
  font-family: var(--font-heading, var(--font-body)); font-weight: 700; font-size: clamp(15px, 4.6vw, 24px); text-transform: uppercase;
}
.mc-cell.black { background: var(--color-neutral-800, #2a2622); cursor: default; }
.mc-code { position: absolute; inset-block-start: 2px; inset-inline-start: 3px; font-family: var(--font-body); font-weight: 500; font-size: 9px; color: var(--color-neutral-500); }
.mc-let { line-height: 1; }
.mc-cell.given { background: var(--color-accent-100); }
.mc-cell.given .mc-let { color: var(--color-accent-800, #3f5a24); }
.mc-cell.active { background: var(--color-accent-200); box-shadow: inset 0 0 0 2px var(--color-accent); }
.mc-cell.active.given { box-shadow: inset 0 0 0 2px var(--color-accent-600, #5a7a2a); }

.mc-alpha { display: grid; grid-template-columns: repeat(13, 1fr); gap: 4px; inline-size: 100%; }
.mc-akey {
  aspect-ratio: 1; border: 1px solid var(--color-neutral-400); border-radius: var(--radius-sm);
  background: var(--color-neutral-100); color: var(--color-text); font-family: var(--font-body); font-size: 13px; cursor: pointer; padding: 0;
}
.mc-akey:hover:not(:disabled) { background: var(--color-accent-100); }
.mc-akey.used { background: var(--color-neutral-300); color: var(--color-neutral-500); }
.mc-akey:disabled { opacity: 0.6; cursor: default; }

/* Dark page */
.mc-root.mode-dark { color: #ece8e2; }
.mc-root.mode-dark .mc-grid { background: #403c38; outline-color: #403c38; }
.mc-root.mode-dark .mc-cell { background: #262421; color: #ece8e2; }
.mc-root.mode-dark .mc-cell.black { background: #0f0e0c; }
.mc-root.mode-dark .mc-code { color: #8b857c; }
.mc-root.mode-dark .mc-cell.given { background: var(--color-accent-900, #2a3a1a); }
.mc-root.mode-dark .mc-cell.given .mc-let { color: var(--color-accent-300); }
.mc-root.mode-dark .mc-cell.active { background: var(--color-accent-800, #3a4a2a); box-shadow: inset 0 0 0 2px var(--color-accent-500); }
.mc-root.mode-dark .mc-akey { background: #262421; color: #ece8e2; border-color: #403c38; }
.mc-root.mode-dark .mc-akey:hover:not(:disabled) { background: #322f2a; }
.mc-root.mode-dark .mc-akey.used { background: #1a1917; color: #6f6a63; }
