/* Shared activity frame. Each game family supplies its own play surface. */
.md-game-shell { --md-tabletop: #ede6db; --md-tabletop-text: #242a29; --md-tabletop-border: #bdb2a0; max-width: 46rem; margin: 0 auto; }
.md-game-intro { text-align: center; }
.md-game-title { margin: 0 0 .625rem; font-size: clamp(1.5rem, 3.5vw, 2rem); font-weight: 650; letter-spacing: -.02em; }
.md-game-instructions { max-width: 36rem; margin: 0 auto; font-size: 1.25rem; line-height: 1.6; }
.md-game-hint { max-width: 36rem; margin: .5rem auto 0; color: var(--hs-muted-text); font-size: 1rem; line-height: 1.5; }
.md-game-progress-group { max-width: 38rem; margin: 1.5rem auto 0; }
.md-game-progress-label { margin: 0 0 .5rem; color: var(--hs-text); font-size: 1.125rem; font-weight: 550; }
.md-game-progress { display: block; width: 100%; height: .5rem; overflow: hidden; border: 0; border-radius: 1rem; background: var(--hs-muted-surface); color: var(--hs-accent); accent-color: var(--hs-accent); }
.md-game-progress::-webkit-progress-bar { background: var(--hs-muted-surface); border-radius: 1rem; }
.md-game-progress::-webkit-progress-value { background: var(--hs-accent); border-radius: 1rem; }
.md-game-progress::-moz-progress-bar { background: var(--hs-accent); border-radius: 1rem; }
.md-game-shell .md-game-actions { justify-content: center; margin-top: 0; }
.md-game-shell .md-game-actions .btn { --hs-button-min-height: 3.5rem; --hs-button-font-size: 1.125rem; --hs-button-padding-y: .875rem; --hs-button-padding-x: 1.5rem; min-width: 15rem; min-height: 3.5rem; padding: .875rem 1.5rem; font-size: 1.125rem; }
.md-game-shell .btn:focus-visible { outline: 3px solid var(--hs-accent); outline-offset: 4px; }

/* Pair-matching surface: Sock Match and the internal label-content fixture. */
.md-game-shell .md-board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(.5rem, 1.7vw, .875rem); max-width: 40rem; margin: 1.25rem auto 1.5rem; padding: .875rem; border: 1px solid var(--md-tabletop-border); border-radius: 1rem; background: var(--md-tabletop); }
.md-game-shell .md-tile { width: 100%; position: relative; display: grid; grid-template-rows: minmax(0, 1fr) auto; align-items: center; justify-items: center; gap: .375rem; min-width: 0; min-height: 5.5rem; aspect-ratio: 1 / 1.12; padding: .625rem .375rem; border: 2px solid var(--md-tabletop-border); border-radius: .75rem; background: #fffdf7; color: var(--md-tabletop-text); box-shadow: none; touch-action: manipulation; }
.md-game-shell .md-tile[data-face-down="false"] { background: #fffdf7; color: var(--md-tabletop-text); }
.md-game-shell .md-tile[aria-pressed="true"] { border-color: #332447; box-shadow: inset 0 0 0 2px #332447; }
.md-game-shell .md-tile[aria-pressed="true"]::after { content: ''; position: absolute; top: .4rem; right: .4rem; width: .7rem; height: .7rem; border-radius: 50%; background: #332447; }
.md-game-shell .md-tile:focus-visible { outline: 3px solid var(--hs-accent); outline-offset: 3px; }
.md-game-shell .md-tile:disabled { opacity: 1; cursor: default; }
.md-game-shell .md-tile[data-matched="true"] { border-color: #718173; background: #f2f4ed; box-shadow: none; }
.md-game-shell .md-tile[data-matched="true"]::after { content: '✓'; position: absolute; top: .25rem; right: .375rem; color: #332447; font-size: 1rem; font-weight: 750; line-height: 1; }
.md-game-shell .md-tile[data-mismatch="true"] { border-color: #b42318; box-shadow: inset 0 0 0 2px #b42318; outline: 3px solid #b42318; outline-offset: 2px; }
.md-sock { display: block; width: 100%; aspect-ratio: 1; background: url('../images/sock-match-atlas-v3.png') var(--sock-x) var(--sock-y) / 400% 200% no-repeat; }
.md-sock[data-sock-style="pattern"] { background-image: url('../images/sock-match-atlas-v2.png'); }
.md-sock[data-sock-style="medium"] { background-image: url('../images/sock-match-medium-v4.png'); }
.md-sock[data-sock-style="hard"] { background-image: url('../images/sock-match-hard-v5.png'); }
.md-game-shell .md-sock { width: 100%; max-width: 9rem; max-height: 100%; min-height: 0; }
.md-game-shell .md-tile-label { max-width: 100%; font-size: 1rem; font-weight: 650; line-height: 1.25; overflow-wrap: anywhere; }
.md-game-shell .md-tile-label:empty { min-height: 1.25em; }
.md-game-shell .md-tile[data-face-down="true"] { border-color: var(--md-tabletop-border); background: #fffdf7; }
.md-game-shell .md-tile-cover { display: grid; place-items: center; width: 65%; height: 80%; border: 2px solid #81788c; border-radius: .75rem; background: #e5e0e8; color: #51495f; font-size: clamp(1.75rem, 5vw, 3rem); font-weight: 550; line-height: 1; }
.md-game-shell .md-match-content { display: grid; place-items: center; width: 100%; height: 100%; padding: .25rem; font-size: clamp(1rem, 2.5vw, 1.625rem); font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }

.md-game-shell.md-game-summary { display: block; width: 100%; max-width: 44rem; }
.md-game-shell.md-session-break { display: grid; grid-template: 1fr / 1fr; align-items: center; min-height: min(42rem, calc(100dvh - 12rem)); padding: 1.5rem 0; }
.md-patient-complete { position: relative; width: 100%; overflow: hidden; }
.md-patient-complete .md-actions { justify-content: center; flex-wrap: wrap; }
.md-patient-complete .btn { min-width: 0; min-height: 3.5rem; padding: .875rem 1.5rem; font-size: 1.125rem; white-space: normal; }
.md-patient-complete .md-actions > .btn { flex: 1 1 12rem; max-width: 25rem; }
.md-confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; animation: md-confetti-finish 2.3s step-end both; }
.md-confetti span { position: absolute; top: -1rem; left: var(--confetti-x); width: .5rem; height: .875rem; border-radius: 2px; background: var(--confetti-color); opacity: 0; animation: md-confetti-fall 2s ease-out var(--confetti-delay) both; }
@keyframes md-confetti-fall {
  0% { opacity: 0; transform: translate(0, 0) rotate(0); }
  10%, 65% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--confetti-drift), 24rem) rotate(300deg); }
}
@keyframes md-confetti-finish { to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .md-confetti { display: none; animation: none; }
  .md-confetti span { animation: none; }
}
@media (max-width: 575.98px) {
  .md-game-instructions { font-size: 1.25rem; }
  .md-game-shell .md-board { gap: .375rem; padding: .5rem; border-radius: .875rem; }
  .md-game-shell .md-tile { min-height: 4.75rem; padding: .4rem .2rem; gap: .25rem; border-radius: .625rem; }
  .md-game-shell .md-tile-label { font-size: .9375rem; letter-spacing: -.02em; }
  .md-game-shell .md-tile[data-matched="true"]::after { top: .2rem; right: .2rem; font-size: .875rem; }
  .md-game-shell .md-game-actions .btn { --hs-button-min-height: 3.5rem; --hs-button-font-size: 1.125rem; --hs-button-padding-y: .875rem; --hs-button-padding-x: 1.5rem; width: 100%; }
}
@media (forced-colors: active) {
  .md-game-shell .md-tile[aria-pressed="true"] { outline: 3px solid Highlight; outline-offset: -5px; }
  .md-game-shell .md-tile[data-matched="true"] { border-color: GrayText; }
  .md-game-shell .md-tile[data-mismatch="true"] { border-style: double; outline-color: CanvasText; }
  .md-confetti { display: none; }
}
@media (max-width: 575.98px) {
  .md-game-shell .md-board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  :root[data-hs-font-size="large"] .md-game-shell .md-board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Landscape keeps the whole board visible beside its instructions and controls. */
@media (min-width: 960px) and (max-height: 900px) {
  .md-game-shell { max-width: 70rem; display: grid; grid-template-columns: minmax(14rem, .7fr) minmax(0, 1.3fr); grid-template-rows: auto 1fr auto; gap: 1.25rem 2rem; align-items: start; }
  .md-game-shell > .md-patient-complete { grid-column: 1 / -1; width: 100%; }
  .md-game-intro { grid-column: 1; grid-row: 1; text-align: left; padding-top: .5rem; }
  .md-game-progress-group { grid-column: 1; grid-row: 2; width: 100%; margin: 0; }
  .md-game-shell .md-board { grid-column: 2; grid-row: 1 / span 3; width: 100%; max-width: clamp(20rem, calc(100svh - 10rem), 40rem); aspect-ratio: 1; gap: .5rem; padding: .5rem; margin: 0 auto; }
  .md-game-shell .md-tile { min-height: 0; aspect-ratio: 1; }
  .md-game-shell .md-game-actions { grid-column: 1; grid-row: 3; align-self: end; }
  .md-game-shell .md-game-actions .btn { width: 100%; }
}
@media (min-width: 600px) and (max-width: 959.98px) {
  .md-game-shell .md-board { max-width: clamp(18rem, calc((100svh - 20rem) * .85), 40rem); }
  .md-game-shell .md-tile { min-height: 3.5rem; aspect-ratio: 1; }
}

/* Sorting uses labeled controls so color is never the only cue. */
.md-sorting-surface { margin: 1.25rem auto 1.5rem; }
.md-sort-board, .md-sort-bowls { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; }
.md-sort-board { padding: .75rem; border: 1px solid var(--hs-border); border-radius: 1rem; background: var(--hs-muted-surface); }
.md-sort-slot { min-width: 0; display: grid; min-height: 7.5rem; }
.md-sort-item, .md-sort-bowl { min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .625rem; padding: .75rem .375rem; border: 2px solid var(--hs-border); border-radius: .75rem; background: var(--hs-surface); color: var(--hs-text); font-size: 1rem; font-weight: 600; line-height: 1.4; touch-action: manipulation; overflow-wrap: anywhere; }
.md-sort-item[aria-pressed="true"] { border-color: var(--hs-text); box-shadow: inset 0 0 0 2px var(--hs-text); }
.md-sort-item:focus-visible, .md-sort-bowl:focus-visible { outline: 3px solid var(--hs-accent); outline-offset: 4px; }
.md-sort-item:disabled, .md-sort-bowl:disabled { opacity: 1; cursor: default; }
.md-sort-empty { display: grid; place-items: center; border: 2px dashed var(--hs-border); border-radius: .75rem; color: var(--hs-muted-text); font-size: 1rem; }
.md-sort-bowls { margin-top: 1.25rem; }
.md-sort-bowl { min-height: 8rem; border-width: 3px; border-radius: .5rem .5rem 2.25rem 2.25rem; }
.md-sort-bowl:disabled { border-style: dashed; }
.md-sewing-button { display: grid; flex-shrink: 0; grid-template-columns: repeat(2, .4rem); gap: .4rem; place-content: center; width: 3.75rem; height: 3.75rem; border: 3px solid var(--button-color); border-radius: 50%; background: var(--button-color); box-shadow: inset 0 0 0 3px rgba(255,255,255,.65); }
.md-sewing-button[data-shape="square"] { border-radius: .625rem; }
.md-sewing-button i { width: .4rem; height: .4rem; border-radius: 50%; background: #fff; }
.md-sort-bowl .md-sewing-button { width: 2.75rem; height: 2.75rem; }
.md-sort-item[data-mismatch="true"], .md-sort-bowl[data-mismatch="true"] { outline: 3px solid #b42318; outline-offset: 2px; border-color: #b42318; }
@media (max-width: 575.98px) {
  .md-sort-board, .md-sort-bowls { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .625rem; }
}
@media (min-width: 960px) and (max-height: 900px) {
  .md-sorting-surface { grid-column: 2; grid-row: 1 / span 3; width: 100%; margin: 0; }
}
@media (forced-colors: active) {
  .md-sort-item[aria-pressed="true"] { outline: 3px solid Highlight; outline-offset: -5px; }
  .md-sewing-button { border-color: ButtonText; box-shadow: none; }
  .md-sort-item[data-mismatch="true"], .md-sort-bowl[data-mismatch="true"] { border-style: double; outline-color: CanvasText; }
}

/* Content v2 uses real object artwork on a quiet tabletop. */
.md-game-sorting, .md-game-matching { max-width: 78rem; }
.md-game-sorting .md-game-intro, .md-game-matching .md-game-intro { position: sticky; top: 4.5rem; z-index: 3; background: var(--hs-bg); padding: .75rem 0; }
.md-game-round { margin: .5rem 0 0; color: var(--hs-muted-text); font-weight: 600; }
.md-game-sorting .md-sort-scene { padding: clamp(.75rem, 2vw, 1.5rem); border: 1px solid var(--md-tabletop-border); border-radius: 1rem; background: var(--md-tabletop); color: var(--md-tabletop-text); }
.md-sort-scene .md-sort-board { padding: .5rem 0 1rem; border: 0; border-radius: 0; background: transparent; grid-template-columns: repeat(var(--tray-columns), minmax(0, 1fr)); gap: .75rem; }
.md-sort-scene .md-sort-slot { min-height: 7.75rem; }
.md-sort-scene .md-sort-item { width: 100%; padding: .25rem; border: 2px solid transparent; background: transparent; color: #242a29; box-shadow: none; gap: .15rem; justify-content: end; cursor: grab; touch-action: none; }
.md-sort-scene .md-sort-item[aria-pressed="true"] { background: #fff9ed; border-color: #393344; box-shadow: none; }
.md-sort-scene .md-sort-item-label { max-width: 100%; min-height: 1.5rem; font-size: 1rem; line-height: 1.4; }
.md-sort-sprite { display: block; flex-shrink: 0; width: 6rem; height: 6rem; background: url('../images/button-sort-atlas-v2.png') var(--sprite-x) var(--sprite-y) / 400% 300% no-repeat; }
.md-sort-button-art[data-size="small"] { width: 3.75rem; height: 3.75rem; margin-top: 2.25rem; }
.md-sort-scene .md-sort-empty { color: #6c675f; border: 1px dashed #c6bcad; background: transparent; font-size: 1rem; }
.md-sort-scene .md-sort-bowls { grid-template-columns: repeat(var(--bowl-count), minmax(0, 1fr)); gap: .5rem; padding-top: 1rem; margin-top: .5rem; border-top: 1px solid #bdb2a0; }
.md-sort-scene .md-sort-bowl { position: relative; min-height: 11rem; padding: .25rem; border: 2px solid transparent; border-radius: .75rem; background: transparent; color: #242a29; gap: .25rem; justify-content: start; }
.md-sort-scene .md-sort-bowl:disabled { border-style: solid; }
.md-sort-scene .md-sort-bowl:not(:disabled):hover, .md-sort-scene .md-sort-bowl[data-hint="true"] { border-color: #51495f; background: #fff9ed; }
.md-sort-scene .md-sort-bowl-art { width: 100%; max-width: 13rem; height: auto; aspect-ratio: 1; position: relative; }
.md-sort-bowl-label { position: relative; display: block; width: 100%; padding: .375rem .25rem; border-radius: .375rem; background: #fffdf7; color: #202628; line-height: 1.4; font-size: 1.0625rem; }
.md-sort-bowl-count { font-size: .9375rem; font-weight: 500; }
.md-sort-pile { position: absolute; left: 15%; right: 15%; top: 38%; height: 33%; overflow: hidden; pointer-events: none; }
.md-sort-pile .md-sort-sprite { position: absolute; width: 32%; height: auto; aspect-ratio: 1; margin: 0; transform: rotate(calc(var(--pile-index) * 13deg)); }
.md-sort-options { color: #242a29; padding: .25rem; }
.md-sort-options summary { width: fit-content; font-size: 1rem; font-weight: 600; cursor: pointer; min-height: 2.75rem; display: list-item; align-content: center; }
.md-sort-options[open] { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.md-sort-options[open] summary { width: 100%; }
.md-sort-options label { display: flex; align-items: center; gap: .5rem; min-height: 2.75rem; font-size: 1rem; }
.md-sort-options input { width: 1.5rem; height: 1.5rem; accent-color: #51495f; }
.md-sort-help { margin: .25rem 0; min-height: 1.5rem; font-size: 1rem; }
.md-sort-scene .md-sort-item[data-mismatch="true"] { border-color: #91621b; outline: 2px solid #91621b; outline-offset: 2px; }
.md-sort-drag { position: fixed; z-index: 1100; width: 6rem; height: 6rem; margin: 0 !important; transform: translate(-50%, -50%); opacity: .95; pointer-events: none; }
.md-sort-round-ready { grid-column: 1 / -1; padding: 1.5rem; text-align: center; }
.md-game-sorting .md-game-actions, .md-game-matching .md-game-actions { flex-wrap: wrap; }
.md-game-sorting .md-game-actions .btn, .md-game-matching .md-game-actions .btn { min-width: 0; }
.md-game-sorting .md-patient-complete .md-actions, .md-game-matching .md-patient-complete .md-actions { justify-content: center; flex-wrap: wrap; }
@media (min-width: 960px) {
  .md-game-sorting, .md-game-matching { display: grid; grid-template-columns: minmax(14rem, .5fr) minmax(0, 1.5fr); grid-template-rows: auto 1fr auto; gap: 1.25rem 2rem; align-items: start; }
  .md-game-matching .md-board { grid-column: 2; grid-row: 1 / span 3; width: 100%; margin: 0 auto; }
  .md-game-sorting .md-sort-scene { grid-column: 2; grid-row: 1 / span 3; width: 100%; margin: 0; }
  .md-game-sorting .md-game-intro, .md-game-matching .md-game-intro { grid-column: 1; grid-row: 1; text-align: left; }
  .md-game-sorting .md-game-progress-group, .md-game-matching .md-game-progress-group { grid-column: 1; grid-row: 2; width: 100%; margin: 0; }
  .md-game-sorting .md-game-actions, .md-game-matching .md-game-actions { grid-column: 1; grid-row: 3; }
}
@media (max-width: 575.98px) {
  .md-sort-scene .md-sort-board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md-sort-scene .md-sort-bowls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md-sort-scene .md-sort-bowl { min-height: 10rem; }
  .md-sort-scene .md-sort-bowls:has(> :last-child:nth-child(3)) > :last-child { grid-column: 1 / -1; max-width: 50%; width: 100%; justify-self: center; }
  .md-sort-options[open] { flex-direction: column; align-items: stretch; }
}
@media (forced-colors: active) {
  .md-sort-scene .md-sort-item { border-color: ButtonText; }
  .md-sort-scene .md-sort-item[aria-pressed="true"], .md-sort-scene .md-sort-bowl[data-hint="true"] { outline: 3px solid Highlight; }
}

/* Keep atlas cells square; shrinking their height distorts the sock artwork. */
.md-game-shell .md-sock-board { max-width: 44rem; aspect-ratio: auto; }
.md-game-shell .md-sock-board .md-tile { aspect-ratio: auto; grid-template-rows: auto auto; }
.md-game-shell .md-sock-board .md-sock,
.md-game-shell .md-sock-board .md-tile-cover { width: 100%; height: auto; max-width: none; max-height: none; aspect-ratio: 1; }
.md-game-shell .md-sock-board .md-tile-label { text-align: center; overflow-wrap: normal; }
@media (max-width: 480px) { .md-game-shell .md-sock-board { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Word search uses calm typography, generous cells and confirmed word outlines. */
.md-game-word-search { min-width: 0; max-width: 68rem; }
.md-game-word-search .md-game-title { margin-bottom: .5rem; }
.md-game-word-search .md-game-instructions { font-size: 1.25rem; line-height: 1.45; }
.md-game-word-search .md-game-hint { font-size: 1.0625rem; line-height: 1.45; }
.md-word-surface { min-width: 0; width: 100%; margin: 1rem auto; }
.md-word-scroll { width: 100%; max-width: 100%; overflow-x: auto; padding: .375rem; border-radius: .5rem; overscroll-behavior-x: contain; }
.md-word-scroll:focus-visible { outline: 3px solid var(--hs-accent); outline-offset: 1px; }
.md-word-grid { --word-cell: max(44px, 3.375rem); display: grid; grid-template-columns: repeat(var(--word-columns), var(--word-cell)); gap: .25rem; width: max-content; margin: 0 auto; padding: .375rem; border: 1px solid var(--hs-border); border-radius: .625rem; background: var(--hs-muted-surface); user-select: none; -webkit-user-select: none; touch-action: none; }
.md-word-cell { display: grid; place-items: center; width: var(--word-cell); height: var(--word-cell); min-width: 44px; min-height: 44px; padding: 0; border: 2px solid var(--hs-control-border); border-radius: .375rem; background: var(--hs-surface); color: var(--hs-text); font-family: inherit; font-size: 1.75rem; font-weight: 600; line-height: 1; cursor: pointer; }
.md-word-cell[data-found="true"] { border-color: var(--hs-text); box-shadow: inset 0 0 0 1px var(--hs-text); background: var(--hs-muted-surface); }
.md-word-grid .md-word-cell[aria-pressed="true"] { border-color: var(--hs-accent); outline: 3px solid var(--hs-accent); outline-offset: -5px; }
.md-word-grid .md-word-cell:focus-visible { position: relative; z-index: 1; outline: 3px solid var(--hs-accent); outline-offset: 2px; }
.md-word-cell:disabled { opacity: 1; cursor: default; }
.md-word-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem 1rem; max-width: 30rem; padding: 0; margin: .875rem auto 0; list-style: none; }
.md-word-list li { display: flex; align-items: center; gap: .5rem; min-width: 0; color: var(--hs-text); font-size: 1.375rem; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.md-word-check { width: 1.5rem; flex-shrink: 0; text-align: center; }
.md-word-list [data-found="true"] > :last-child { text-decoration: line-through; text-decoration-thickness: 2px; }
.md-word-selection { min-height: 1.5em; max-width: 30rem; margin: .625rem auto 0; color: var(--hs-muted-text); font-size: 1rem; }
.md-game-word-search .md-game-actions { flex-wrap: wrap; }
.md-game-word-search .md-game-actions .btn { min-width: 0; }
.md-game-word-search .md-patient-complete .md-actions { justify-content: center; flex-wrap: wrap; }
.md-edition-picker .modal-dialog { max-width: 56rem; }
.md-edition-picker .modal-title { font-size: 1.5rem; }
.md-patient-card.md-edition-card .md-grit-art { object-fit: contain; border: 1px solid #bdb2a0; border-radius: 1rem; background: #ede6db; }
.md-edition-instructions { margin: 0 0 1rem; font-size: 1.125rem; color: var(--hs-text); }
.md-edition-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.md-edition-option { display: flex; flex-direction: column; gap: .625rem; min-width: 0; }
/* Axis buttons center their contents; picture choices need stable columns. */
.md-edition-choice { --hs-button-min-height: 5rem; --hs-button-padding-y: .75rem; --hs-button-padding-x: .75rem; --bs-border-radius-sm: .75rem; display: flex; flex-direction: column; align-items: center; justify-content: center !important; gap: .75rem !important; width: 100%; text-align: center; }
.md-edition-choice .md-grit-art { width: 7rem; height: 7rem; flex-shrink: 0; object-fit: cover; border-radius: .5rem; background: #ede6db; }
.md-edition-copy { display: flex; flex-direction: column; min-width: 0; gap: .25rem; line-height: 1.3; }
.md-edition-name { font-size: 1.5rem; font-weight: 650; }
.md-edition-action { font-size: 1.125rem; }
.md-edition-picker .modal-footer { display: flex; flex-direction: column; align-items: stretch; gap: .5rem; }
.md-edition-picker .modal-footer > * { margin: 0; }
.md-edition-page-status { margin: 0; text-align: center; color: var(--hs-muted-text); font-size: 1rem; }
.md-edition-page-status:empty { display: none; }
.md-edition-paging:not([hidden]) { display: flex; gap: .75rem; }
.md-edition-paging .btn { flex: 1; min-width: 0; }
.md-edition-picker .modal-footer > .btn { width: 100%; }
.md-edition-picker .md-patient-saved { margin: 0; font-size: 1rem; }
.md-edition-picker .btn:focus-visible { outline: 3px solid var(--hs-accent); outline-offset: 3px; }
.md-edition-picker .modal-footer .btn, .md-edition-option > .btn-white-outline { min-height: 44px; white-space: normal; }
@media (min-width: 576px) {
  .md-edition-picker .modal-footer { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .md-edition-page-status { flex-basis: 100%; }
  .md-edition-paging { flex: 1; }
  .md-edition-picker .modal-footer > .btn { width: auto; }
}
@media (min-width: 1200px) { .md-edition-choice .md-grit-art { width: 8rem; height: 8rem; } }
@media (max-width: 575.98px) {
  .md-edition-choices { grid-template-columns: minmax(0, 1fr); }
  .md-edition-choice { gap: .75rem !important; }
  .md-edition-choice .md-grit-art { width: 6rem; height: 6rem; }
  .md-edition-picker .modal-footer { padding: .75rem; }
}
@media (min-width: 960px) {
  .md-game-word-search { display: grid; grid-template-columns: minmax(14rem, .85fr) minmax(0, 1.15fr); grid-template-rows: auto 1fr auto; gap: 1rem 2rem; align-items: start; }
  .md-game-word-search .md-game-intro { grid-column: 1; grid-row: 1; text-align: left; position: sticky; top: 4.5rem; z-index: 3; padding: .5rem 0; background: var(--hs-bg); }
  .md-game-word-search .md-game-progress-group { grid-column: 1; grid-row: 2; margin: 0; width: 100%; }
  .md-game-word-search .md-game-actions { grid-column: 1; grid-row: 3; }
  .md-game-word-search .md-word-surface { grid-column: 2; grid-row: 1 / span 3; margin: 0; }
}
@media (max-width: 1100px) and (min-width: 960px), (max-width: 575.98px) {
  .md-word-grid { --word-cell: max(44px, 2.75rem); gap: .1875rem; }
  .md-word-cell { font-size: 1.5rem; }
}
@media (max-width: 959.98px) {
  .md-game-word-search .md-game-progress-group { margin-top: 1rem; }
  .md-game-word-search .md-game-intro { padding-top: 0; }
  .md-game-word-search .md-game-actions { margin-top: .5rem; }
}
@media (forced-colors: active) {
  .md-word-cell[data-found="true"] { border: 3px double CanvasText; box-shadow: none; }
  .md-word-grid .md-word-cell[aria-pressed="true"] { outline-color: Highlight; }
}
.md-word-pan:not([hidden]) { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-top: .375rem; font-size: 1rem; color: var(--hs-text); }
.md-word-pan .btn { --hs-button-min-height: 44px; --hs-button-font-size: 1.25rem; min-width: 3.25rem; }
@media (min-width: 576px) and (max-width: 959.98px) {
  .md-word-grid { --word-cell: max(44px, 3rem); }
}
.md-game-word-search > .md-patient-complete { grid-column: 1 / -1; width: 100%; }

/* Photo-supported associations keep one question and its answers together. */
.md-game-shell.md-game-connections { display: block; max-width: 52rem; }
.md-game-connections .md-game-intro { text-align: center; }
.md-game-connections .md-game-progress-group { max-width: 42rem; margin: 1rem auto; }
.md-connection-question { padding: clamp(1rem, 3vw, 2rem); margin: 1rem auto 1.5rem; }
.md-connection-prompt { margin: 0 0 1.25rem; font-size: clamp(1.5rem, 3vw, 2rem); line-height: 1.4; text-align: center; overflow-wrap: anywhere; }
.md-connection-photo { position: relative; width: min(100%, 25rem); aspect-ratio: 1; overflow: hidden; margin: 0 auto 1rem; border: 1px solid var(--hs-border); border-radius: .75rem; background: #ede6db; }
.md-connection-photo img { position: absolute; width: 400%; height: 300%; max-width: none; }
.md-connection-preview { background: url('../images/connections-easy-v1.png') 0 0 / 400% 300% no-repeat; aspect-ratio: 1; }
.md-patient-home .md-patient-card .md-connection-preview { display: flex; justify-content: center; border: 1px solid #bdb2a0; border-radius: 1rem; overflow: hidden; background: #ede6db; }
.md-patient-home .md-connection-preview::before { content: ''; display: block; height: 100%; aspect-ratio: 1; background: url('../images/connections-easy-v1.png') 0 0 / 400% 300% no-repeat; }
.md-connection-help { justify-content: center; flex-wrap: wrap; }
.md-game-connections .md-connection-question .btn { --hs-button-min-height: 3.5rem; --hs-button-font-size: 1.25rem; --hs-button-padding-y: .875rem; --hs-button-padding-x: 1.25rem; min-height: 3.5rem; font-size: 1.25rem; }
.md-connection-help .btn, .md-connection-choices .btn, .md-connection-next { min-height: 3.5rem; padding: .875rem 1.25rem; font-size: 1.25rem; white-space: normal; overflow-wrap: anywhere; }
.md-connection-hint, .md-connection-speech-note { text-align: center; font-size: 1.125rem; }
.md-connection-hint { padding: .75rem; background: var(--hs-muted-surface); border-radius: .5rem; }
.md-connection-speech-note:empty { display: none; }
.md-connection-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .875rem; margin-top: 1rem; }
.md-connection-choices .btn { width: 100%; border: 2px solid var(--hs-border); background: var(--hs-surface); color: var(--hs-text); font-weight: 600; }
.md-connection-choices .btn:disabled { opacity: 1; cursor: default; }
.md-connection-choices .btn[data-correct="true"] { background: #e3f1e4; color: #19482c; border-color: #347246; }
.md-connection-feedback { min-height: 1.5em; margin: 1.25rem 0 .5rem; font-size: 1.25rem; line-height: 1.5; }
.md-connection-feedback:empty { display: none; }
.md-connection-feedback[data-correct="true"] { padding: .875rem; border-radius: .5rem; background: #e3f1e4; color: #19482c; }
.md-connection-next { display: block; width: 100%; margin-top: 1rem; }
@media (min-width: 960px) {
  .md-game-shell.md-game-connections:not(.md-game-summary) { max-width: 60rem; }
  .md-connection-question { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .5rem 1.5rem; align-items: start; }
  .md-connection-prompt { grid-column: 1 / -1; }
  .md-connection-photo { grid-column: 1; grid-row: 2 / span 6; margin: 0 auto; }
  .md-connection-help { grid-column: 2; grid-row: 2; margin: 0; }
  .md-connection-hint { grid-column: 2; grid-row: 4; }
  .md-connection-speech-note { grid-column: 2; grid-row: 5; }
  .md-connection-choices { grid-column: 2; grid-row: 3; grid-template-columns: 1fr; margin: 0; }
  .md-connection-feedback { grid-column: 2; grid-row: 6; }
  .md-connection-next { grid-column: 2; grid-row: 7; }
}
@media (max-width: 575.98px) {
  .md-connection-choices { grid-template-columns: 1fr; }
  .md-connection-help .btn { flex: 1 1 8rem; }
}
@media (forced-colors: active) {
  .md-connection-choices .btn[data-correct="true"] { border: 3px solid Highlight; }
}

.md-difficulty-picker { max-width: 38rem; margin-inline: auto; }
.md-difficulty-choices { display: grid; gap: 1rem; margin: 1.5rem 0; }
.md-difficulty-option { display: grid; gap: .5rem; }
.md-difficulty-option > .btn-primary { --hs-button-min-height: 4rem; --hs-button-font-size: 1.25rem; min-height: 4rem; font-size: 1.25rem; flex-direction: column; }
.md-difficulty-saved { display: block; margin-top: .25rem; font-size: .9375rem; font-weight: 450; }
