/* 所有遊戲共用：開始畫面的返回按鈕固定在右上角。 */
.game-menu-return {
  position: fixed !important;
  top: calc(12px + env(safe-area-inset-top, 0px)) !important;
  right: calc(14px + env(safe-area-inset-right, 0px)) !important;
  bottom: auto !important;
  left: auto !important;
  z-index: 10;
  width: auto !important;
  min-width: 0 !important;
  min-height: 42px !important;
  margin: 0 !important;
  padding: 9px 15px !important;
  border: 1px solid rgba(255, 255, 255, .72) !important;
  border-radius: 999px !important;
  color: #fff !important;
  background: rgba(15, 23, 42, .82) !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .3) !important;
  font-family: inherit !important;
  font-size: 14px !important;
  font-weight: 800 !important;
  line-height: 1.2 !important;
  text-align: center !important;
  white-space: nowrap;
  cursor: pointer;
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

/* 所有遊戲共用：暫停畫面的繼續／返回按鈕保留清楚間距。 */
.game-pause-actions {
  display: flex !important;
  align-items: center;
  justify-content: center;
  column-gap: 22px !important;
  row-gap: 16px !important;
  flex-wrap: wrap !important;
}

/* 所有遊戲共用：開始畫面只留一句短簡介，詳細玩法收進「！」。 */
.game-intro-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  max-width: min(620px, 92vw);
  margin: 2px auto 8px;
  color: rgba(255,255,255,.92);
  font-size: clamp(15px, 2.4vw, 18px);
  font-weight: 700;
  line-height: 1.45;
  text-align: center;
}

.game-info-button,
.game-info > summary {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  margin: 0;
  padding: 0;
  border: 2px solid rgba(255,255,255,.9);
  border-radius: 50%;
  background: rgba(15,23,42,.82);
  color: #ffd75e;
  box-shadow: 0 4px 14px rgba(0,0,0,.35);
  font: 900 23px/1 Arial, sans-serif;
  text-decoration: none;
  cursor: pointer;
  list-style: none;
  -webkit-tap-highlight-color: transparent;
}

.game-info > summary::-webkit-details-marker { display: none; }
.game-info > summary::marker { content: ''; }
.game-info > summary:focus-visible,
.game-info-button:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

.game-info[open]::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9997;
  background: rgba(3,7,18,.82);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

.game-info[open] > summary {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top, 0px));
  right: calc(14px + env(safe-area-inset-right, 0px));
  z-index: 9999;
}

.game-info-panel {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 9998;
  width: min(620px, calc(100vw - 32px));
  max-height: min(76vh, 680px);
  max-height: min(76dvh, 680px);
  overflow: auto;
  transform: translate(-50%, -50%);
  padding: 24px;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 18px;
  background: #172033;
  color: #f8fafc;
  box-shadow: 0 20px 70px rgba(0,0,0,.65);
  font-size: 15px;
  line-height: 1.8;
  text-align: left;
  touch-action: pan-y;
}

.game-info-panel h2 { margin: 0 0 12px; color: #ffd75e; text-align: center; }
.game-info-panel b { color: #ffe79a; }
.game-info-canvas { position: fixed; z-index: 9003; }
.game-info-canvas[hidden] { display: none; }

@media (max-width: 600px) {
  .game-intro-line { font-size: 15px; }
  .game-info-panel { padding: 20px 18px; font-size: 14px; }
}

.game-pause-actions > button {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

@media (max-width: 480px) {
  .game-menu-return {
    top: calc(8px + env(safe-area-inset-top, 0px)) !important;
    right: calc(8px + env(safe-area-inset-right, 0px)) !important;
    min-height: 40px !important;
    padding: 8px 12px !important;
    font-size: 13px !important;
  }
}
