/* THW Design: Duotrigordle ([thw_duo]). Needs thw-design.css, thw-wordle.css, thw-multi.css and thw-share.css.
 * Phones and tablets: 4 boards across, 8 rows of boards, tiles at least 14px. Desktop: 8 across, 4 rows, tiles up to
 * 26px, never below 14px (a short window scrolls). The keyboard is pinned to the bottom of the screen while the game
 * is on screen (sticky inside the game section, so it lets go after it) on every width, because the boards grow
 * one row per guess. Solved boards are dimmed so the unsolved ones stand out. */
.thw-ds .mg-top .mg-duo{order:0}
.thw-ds .mg-duo{--gap:2px;--bgap:8px;--bw:1px;--cell:max(14px,min(24px,calc((100vw - 88px) / 20)))}
.thw-ds .mg-duo .mg-boards{grid-template-columns:repeat(4,max-content);align-items:start;row-gap:14px;padding-bottom:8px}
/* Tiles from the game section's own width (container query units), so the 8 or 4 boards always fit inside it.
 * 56px = gaps inside 4 boards (32) and between them (24). */
@supports (container-type:inline-size){
  .thw-ds .mg-duo{container-type:inline-size;--cell:max(14px,min(24px,calc((100cqw - 56px) / 20)))}
}
.thw-ds .mg-duo .mg-board{border-radius:4px;outline:0 solid transparent;transition:opacity .2s,outline-color .2s}
.thw-ds .mg-duo .mg-board:focus{outline:none}
.thw-ds .mg-duo .mg-board.done{opacity:.32}
.thw-ds .mg-duo .mg-board.duo-hl{outline:3px solid var(--acc);outline-offset:3px;opacity:1}
.thw-ds .mg-duo .mg-cell{font:700 calc(var(--cell) * .7)/1 var(--body);border-radius:max(2px,calc(var(--cell) * .14))}
.thw-ds .mg-duo .mg-cell.flip{animation-duration:.3s}

/* Bar: modes on the left, Show result and New round on the right. */
.thw-ds .mg-duo .mg-bar{flex-wrap:wrap}

/* Keyboard strip: counts and Next unsolved board, always next to the keys. */
.thw-ds .mg-duo .mg-kb{position:sticky;bottom:0;z-index:4;align-self:stretch;max-width:none;background:var(--bg);padding:6px 0 max(8px,env(safe-area-inset-bottom,0px));box-shadow:0 -6px 0 var(--bg)}
.thw-ds .mg-duo .mg-kr,.thw-ds .mg-duo .duo-strip{width:100%;max-width:620px;margin:0 auto}
/* Two short count lines on the left, the button on the right: fits 320px wide screens. */
.thw-ds .mg-duo .duo-strip{display:grid;grid-template-columns:minmax(0,1fr) auto;column-gap:8px;align-items:center}
.thw-ds .mg-duo .duo-st{grid-column:1;font:700 12.5px/1.25 var(--body);color:var(--ink);font-variant-numeric:tabular-nums;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.thw-ds .mg-duo .duo-next{grid-column:2;grid-row:1 / span 2;min-height:44px;font-size:13.5px;padding:0 12px;box-shadow:3px 3px 0 var(--sh);white-space:nowrap}
.thw-ds .mg-duo .mg-kb[hidden]{display:none}

/* Round over: a card over the top of the boards, so showing it never moves the page. */
/* Centred with left/right auto margins: the shared card's entry animation owns the transform property. */
.thw-ds .mg-duo .duo-end{position:absolute;top:6px;left:0;right:0;margin:0 auto;z-index:6;width:min(460px,100%);box-sizing:border-box;max-width:none}
.thw-ds .mg-duo .duo-close{position:absolute;top:6px;right:6px;width:44px;height:44px;border:0;background:transparent;color:var(--ink);font:400 28px/1 var(--body);cursor:pointer;border-radius:10px}
.thw-ds .mg-duo .duo-close:focus-visible{outline:3px solid var(--acc)}
.thw-ds .mg-duo .duo-cd{margin:6px 0 0;font:700 14px/1.3 var(--body);font-variant-numeric:tabular-nums}
.thw-ds .mg-duo .duo-cd:empty{display:none}
.thw-ds .mg-duo .duo-missed{grid-template-columns:repeat(3,minmax(0,1fr));gap:2px 10px;font-size:13px;max-height:220px;overflow:auto}
.thw-ds .mg-duo .duo-missed strong{font:400 15px/1.2 var(--display)}
.thw-ds .mg-duo .thw-sh-counts{display:grid;grid-template-columns:repeat(8,minmax(0,1fr));gap:3px;max-width:340px;margin:10px auto 0}
.thw-ds .mg-duo .thw-sh-counts .thw-sh-c{min-width:0;height:26px;font-size:12px;line-height:26px}

@media (min-width:960px){
  /* 8 boards across. 234px = page gutters 32, card border 6 and padding 48, gaps inside the boards 64, between them 84. */
  .thw-ds .mg-duo{--bw:1.5px;--bgap:12px;--cell:max(14px,min(26px,calc((min(100vw,1280px) - 234px) / 40)))}
  .thw-ds .mg-duo .mg-boards{grid-template-columns:repeat(8,max-content);row-gap:18px}
  /* 148px = gaps inside 8 boards (8 x 4 x 2px) and between them (7 x 12px). */
  @supports (container-type:inline-size){
    .thw-ds .mg-duo{--cell:max(14px,min(26px,calc((100cqw - 148px) / 40)))}
  }
  .thw-ds .mg-duo .mg-kb{background:var(--surf);box-shadow:0 -8px 0 var(--surf);border-radius:0 0 14px 14px}
  .thw-ds .mg-duo .mg-bar{max-width:none}
  .thw-ds .mg-duo .duo-st{font-size:14px}
}
