.main {
  width: 100%;
  max-width: var(--content-width-wide);
}

.mh-panel {
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.mh-heading, .mh-actions, .mh-count-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mh-actions {
  justify-content: center;
}

.mh-heading {
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.mh-panel h2 {
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.mh-panel h3 {
  font-size: 0.875rem;
  margin-top: 1.75rem;
}

.mh-count-label, .mh-note, .mh-rules, .mh-details {
  font-size: 0.8rem;
  line-height: 1.65;
}

.mh-note, .mh-rules {
  color: var(--muted);
  margin-top: 0.75rem;
}

.mh-count-label select, .mh-btn {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
}

.mh-btn {
  font-size: 0.8rem;
  min-height: 40px;
}

.mh-btn:hover {
  border-color: var(--text);
}

.mh-primary {
  background: var(--text);
  color: white;
  border-color: var(--text);
}

.mh-panel button:focus-visible, .mh-panel select:focus-visible, .mh-details summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.mh-instruction {
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
  margin: 1.5rem 0 1rem;
}

.mh-recap {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--muted);
}

.mh-doors {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2rem 1rem;
  max-width: 540px;
  margin: 0 auto 1.5rem;
  padding-top: 1.5rem;
}

.mh-door {
  --door-colour: #416c85;
  position: relative;
  height: 190px;
  border: 3px solid var(--text);
  border-radius: 5px 5px 0 0;
  background: #f3f4f3;
  font-family: var(--ff);
  color: var(--text);
  perspective: 650px;
  cursor: pointer;
}

.mh-door:nth-child(3n + 2) { --door-colour: #b96146; }
.mh-door:nth-child(3n) { --door-colour: #658458; }

.mh-door:disabled {
  cursor: default;
}

.mh-door.mh-selected:not(.mh-choosable) {
  outline: 3px solid var(--door-colour);
  outline-offset: 4px;
}

.mh-door-front {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--door-colour);
  color: white;
  font-size: 2rem;
  font-weight: 700;
  transform-origin: left;
  transition: transform 0.4s ease, opacity 0.4s ease;
  backface-visibility: hidden;
  z-index: 1;
}

.mh-door-front::after {
  content: "";
  position: absolute;
  right: 10%;
  top: 55%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f3d794;
}

.mh-open .mh-door-front {
  transform: rotateY(-100deg);
  opacity: 0;
}

.mh-prize {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.75rem;
}

.mh-prize svg { width: 72%; max-width: 90px; height: 65px; }

.mh-door-tag {
  position: absolute;
  bottom: 8px;
  left: 0;
  width: 100%;
  z-index: 2;
  color: white;
  font-size: 0.65rem;
}

.mh-open .mh-door-tag { color: var(--text); }

.mh-door-choice {
  position: absolute;
  bottom: calc(100% + 9px);
  left: 0;
  width: 100%;
  font-size: 0.8rem;
  font-weight: 700;
  transition: transform 0.25s cubic-bezier(0.34, 1.8, 0.64, 1), color 0.2s;
}

.mh-choosable {
  transition: transform 0.25s ease, opacity 0.2s;
}

.mh-choosable:hover, .mh-choosable:focus-visible {
  transform: translateY(-6px);
}

.mh-choosable:hover .mh-door-front, .mh-choosable:focus-visible .mh-door-front {
  transform: rotateY(-25deg);
}

.mh-choosable:hover .mh-door-choice, .mh-choosable:focus-visible .mh-door-choice {
  transform: scale(1.35);
  color: var(--door-colour);
}

.mh-doors:has(.mh-choosable:hover) .mh-choosable:not(:hover) {
  opacity: 0.55;
}

.mh-doors[data-count="10"] {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  max-width: none;
}

.mh-doors[data-count="10"] .mh-door { height: 125px; }
.mh-doors[data-count="10"] .mh-door-front { font-size: 1.5rem; }

.mh-doors[data-count="100"] {
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 20px 7px;
  max-width: none;
}

.mh-doors[data-count="100"] .mh-door { height: 52px; border-width: 1px; }
.mh-doors[data-count="100"] .mh-door-front { font-size: 0.8rem; }
.mh-doors[data-count="100"] .mh-door-front::after { display: none; }
.mh-doors[data-count="100"] .mh-prize { gap: 0; font-size: 0.6rem; }
.mh-doors[data-count="100"] .mh-prize svg { height: 25px; }
.mh-doors[data-count="100"] .mh-door-tag { bottom: 2px; font-size: 0.55rem; }
.mh-doors[data-count="100"] .mh-door-choice { bottom: calc(100% + 4px); font-size: 0.6rem; }
.mh-doors[data-count="100"] .mh-selected, .mh-doors[data-count="100"] .mh-alternative { outline: 3px solid var(--door-colour); outline-offset: 1px; }
.mh-doors[data-count="100"] .mh-alternative { outline-style: dashed; }

.mh-steps { list-style: none; counter-reset: step; margin-top: 1rem; display: grid; gap: 0.75rem; }
.mh-steps li { counter-increment: step; padding: 1rem 1.25rem; border: 1px solid var(--border); border-radius: 3px; }
.mh-steps h3 { margin-top: 0; }
.mh-steps h3::before { content: counter(step) ". "; }
.mh-steps p { font-size: 0.875rem; line-height: 1.7; margin-top: 0.25rem; }
.mh-steps .mh-step-odds { display: flex; align-items: baseline; gap: 0.6rem; font: 700 1.75rem var(--ff-mono); line-height: 1.2; margin: 0.25rem 0 0.5rem; }
.mh-step-odds span { font: 400 0.8rem var(--ff); line-height: 1.4; color: var(--muted); }
.mh-steps .mh-step-maths { font: 0.8rem var(--ff-mono); margin-top: 0.5rem; }
.mh-bar { display: flex; height: 14px; margin-top: 0.75rem; gap: 3px; }
.mh-bar span { min-width: 0; }
.mh-bar span:first-child { min-width: 2px; }
.mh-bar .mh-faded { opacity: 0.25; }
.mh-steps .mh-bar-labels { display: flex; justify-content: space-between; font-size: 0.7rem; color: var(--muted); margin-top: 0.25rem; }

.mh-details { border-top: 1px solid var(--border); margin-top: 1.25rem; padding-top: 1rem; }
.mh-details summary { cursor: pointer; }
.mh-details p { margin-top: 0.75rem; }
.mh-sources { padding-left: 1.25rem; margin-top: 0.75rem; }
.mh-sources li { margin-top: 0.35rem; }
.mh-sources a { color: var(--text); }

[hidden] { display: none !important; }

@media (max-width: 640px) {
  .mh-panel { padding: 1rem; }
  .mh-doors { gap: 0.65rem; }
  .mh-door { height: 150px; }
  .mh-doors[data-count="10"] .mh-door { height: 95px; }
  .mh-doors[data-count="10"] .mh-door-tag { font-size: 0.55rem; }
  .mh-doors[data-count="100"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .mh-doors[data-count="100"] .mh-door { height: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  .mh-door-front, .mh-choosable, .mh-door-choice { transition: none; }
}
