* { box-sizing: border-box; }
html { color: #373c30; background: #faf7ef; }
body { margin: 0; font-family: Arial, "Noto Sans TC", sans-serif; }
.home { max-width: 1120px; margin: 0 auto; padding: 20px 24px; }
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
h1 { min-width: 0; margin: 0; font-size: 52px; line-height: 1.15; color: #354f3b; }
.games { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.game { min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 18px 14px; min-height: 188px; border: 2px solid #967853; border-radius: 16px; color: #373c30; background: #fff6df; text-align: center; text-decoration: none; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.game:focus { outline: 3px dashed #273f30; outline-offset: 3px; }
/* Both languages use the same icon-above-name layout, independent of older grid rules. */
html[lang] .home .game-art { display: block; flex: 0 0 auto; width: 88px; height: 88px; margin: 0; }
.home .game h2 { max-width: 100%; margin: 0; font-size: 36px; line-height: 1.25; overflow-wrap: break-word; }
.home .game p { margin: 0; font-size: 24px; line-height: 1.3; }
#memory-link, #parking-link { background: #fff2dd; border-color: #98723e; }
#maze-link, #sudoku-link { background: #edf3e5; border-color: #72865d; }
#sokoban-link, #mini-sudoku-link { background: #f8ebe2; border-color: #a1785c; }
#tictactoe-link { background: #f1edf5; border-color: #8b7a96; }
#pipes-link, #typing-link { background: #eaf1f2; border-color: #728b8c; }
.offline-help { margin-top: 24px; padding-top: 16px; border-top: 2px solid #a2aa91; }
.offline-help p { margin: 12px 0 0; font-size: 22px; line-height: 1.5; overflow-wrap: break-word; }
.offline-help .device-note { margin: 0; padding: 0; border: 0; background: none; font-size: 22px; }
.offline-help #offline-status { font-size: 24px; font-weight: bold; color: #354f3b; }
.offline-help summary { min-height: 48px; margin-top: 8px; padding: 8px 0; font-size: 24px; line-height: 1.3; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.offline-help summary:focus-visible { outline: 3px dashed #273f30; outline-offset: 3px; }
@media (min-width: 560px) {
  .games { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1000px) {
  h1 { font-size: 60px; }
  .games { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  html[lang] .home .game-art { width: 104px; height: 104px; }
  .home .game h2 { font-size: 40px; }
}
@media (max-width: 419px) {
  .home { padding: 16px; }
  .site-header { gap: 12px; margin-bottom: 16px; }
  h1 { font-size: 42px; }
  .games { gap: 12px; }
}
/* Without flexbox gap (see shared/interface.css), the title row and each card keep their spacing from margins.
   The cards themselves sit in a grid, whose gap such browsers support. */
@supports not (aspect-ratio: 1 / 1) {
  html:not(.readerplay-kobo) .site-header, html:not(.readerplay-kobo) .home .game { gap: 0; }
  html:not(.readerplay-kobo) .site-header > * + * { margin-left: 16px; }
  html:not(.readerplay-kobo) .home .game > * + * { margin-top: 10px; }
  @media (max-width: 419px) {
    html:not(.readerplay-kobo) .site-header > * + * { margin-left: 12px; }
  }
}
