.arcade-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, clamp(88px, 9vw, 160px)), 1fr));
  gap: 24px clamp(12px, 1.7vw, 30px);
}
.arcade-link {
  display: grid;
  min-width: 0;
  gap: 7px;
  color: inherit;
  text-decoration: none;
}
.arcade-link:hover .arcade-name { text-decoration: underline }
.arcade-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  line-height: 1.25;
}
.arcade-icon {
  display:grid;
  place-items:center;
  font-size:clamp(26px,4vw,52px);
  background:linear-gradient(145deg,#d4ebed,#98c3ce);
  position: relative;
  aspect-ratio: 1;
  border-radius: 24%;
  overflow: hidden;
  container-type: inline-size;
}
.arcade-icon::before, .arcade-icon::after {
  position: absolute;
  display: grid;
  place-items: center;
  font: 800 37cqw/1 system-ui,sans-serif;
  box-shadow: 0 4px 0 #251d502e, 0 8px 12px #251d5024;
}
.icon-pairs { background: radial-gradient(at 20% 0%, #dd9aff, transparent 62%), linear-gradient(145deg,#9b4dda,#41339e) }
.icon-pairs::before,.icon-pairs::after {
  content: "♦";
  width: 43%;
  height: 61%;
  border-radius: 14%;
  color: #ff4176;
  background: #fff4db;
}
.icon-pairs::before { left: 17%; top: 16%; transform: rotate(-19deg); background: #ffc6ca }
.icon-pairs::after { right: 16%; bottom: 15%; transform: rotate(13deg) }
.icon-sequence { background: linear-gradient(145deg,#4fe3cd,#009cab 60%,#166282) }
.icon-sequence::before,.icon-sequence::after {
  width: 46%;
  height: 46%;
  border-radius: 22%;
  transform: rotate(-8deg);
}
.icon-sequence::before { content: "1"; left: 12%; top: 13%; background: #ddfff1; color: #007c84 }
.icon-sequence::after { content: "2"; right: 12%; bottom: 14%; background: #ffdf68; color: #654125; transform: rotate(8deg) }
.arcade-link:not(a):hover .arcade-name { text-decoration:none; }
.game[data-game] {
  aspect-ratio:16/9;
  display:grid;
  align-content:center;
  justify-items:center;
  gap:clamp(6px,1vw,12px);
  padding:8px;
  color:#fff;
  background:radial-gradient(ellipse at top right,#285762,transparent 65%),#162b41;
}
.game[data-game] > .arcade-icon { width:clamp(42px,8vw,90px); }
.game[data-game] #game-status { min-height:0; margin:0; font-size:clamp(13px,1.5vw,17px); }
.game[data-game] #restart { justify-self:center; background:#c4f2d7; color:#183f3a; border-radius:24px; }
.game[data-game] .board:empty, .game:has(.board button) > .arcade-icon { display:none; }
.game[data-game] .board { width:min(86%,320px); margin:0; gap:5px; }
.game[data-game] .board button { min-height:0; height:clamp(32px,5vw,56px); padding:0; background:#f1f7fa; color:#16344a; }
.game[data-game] .board button:disabled { background:#92cfc0; color:#244d48; }
.game:has(.board button) #restart { background:transparent; color:white; padding:2px 12px; font-size:13px; }
.left > .arcade-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}
@media (max-width: 600px) {
  .left > .arcade-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: 10px;
  }
}
.left .arcade-link { align-content:start; text-align:center; font-size:14px; }
.left .arcade-name { white-space:normal; }
.game-exit { display:none; }
.game[data-game].expanded { position:fixed; inset:0; width:100%; height:100dvh; aspect-ratio:auto; margin:0; border:0; border-radius:0; z-index:1000; }
.game.expanded .game-exit { display:block; position:absolute; top:max(10px,env(safe-area-inset-top)); right:max(10px,env(safe-area-inset-right)); }
body:has(.game.expanded) { overflow:hidden; }
.game-title { margin:12px 0 0; font-size:clamp(20px,2vw,26px); line-height:1.25; }
body:has(main > .arcade-grid) {
  display:flex;
  flex-direction:column;
  min-height:100dvh;
}
body:has(main > .arcade-grid) > main { width:100%; }
body:has(main > .arcade-grid) > .discover-footer {
  margin: auto auto 0;
  width:100%;
  padding:8px 16px calc(8px + env(safe-area-inset-bottom)); background:white;
}
@media(max-width:600px) {
  main:has(.game[data-game]) { padding-top:0; }
  .game[data-game]:not(.expanded) { width:100vw; margin-inline:calc(50% - 50vw); border-radius:0; border:0; }
  body:has(main > .arcade-grid) > .discover-footer { flex-direction:column; justify-content:center; gap:3px; }
  body:has(main > .arcade-grid) > .discover-footer img { width:96px; }
}
