/* Shared minigame shell — mirrors the quiz overlay's topbar, card and exit flow. */
#minigame-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 76px;
  background: transparent;
  pointer-events: none;
  overscroll-behavior: none;
  touch-action: none;
}

#minigame-overlay.confirm-open #minigame-card { pointer-events: none; }

#minigame-card {
  --minigame-accent: #ffd24a;
  --minigame-background: #223044;
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(560px, 96vw);
  height: min(900px, calc(100dvh - 76px - 16px));
  overflow: hidden;
  border: 2px solid var(--minigame-accent);
  border-radius: 28px;
  background: var(--minigame-background);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
  animation: cardIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#minigame-topbar {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding: 8px 10px 8px 18px;
  color: #fff;
  background: rgba(16, 28, 42, 0.72);
  border-bottom: 1px solid color-mix(in srgb, var(--minigame-accent) 70%, transparent);
}

#minigame-title {
  overflow: hidden;
  font-size: clamp(17px, 4vw, 21px);
  text-overflow: ellipsis;
  white-space: nowrap;
}

#minigame-close-btn {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 3px solid #9aa4b0;
  border-radius: 8px;
  color: #9aa4b0;
  background: rgba(255, 255, 255, 0.9);
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

#minigame-close-btn:hover {
  color: #ff8f1f;
  border-color: #ff8f1f;
  transform: scale(1.1);
}

#minigame-frame {
  flex: 1;
  width: 100%;
  min-height: 0;
  border: 0;
  background: var(--minigame-background);
}

#minigame-confirm {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(70, 74, 82, 0.55);
  pointer-events: auto;
  touch-action: none;
}

#minigame-confirm.hidden { display: none; }

#minigame-confirm-box {
  max-width: min(360px, 88vw);
  padding: 22px 28px 24px;
  border: 3px solid #ffd24a;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  animation: cardIn 0.25s ease;
  pointer-events: auto;
}

#minigame-confirm-text {
  margin-bottom: 16px;
  color: #2d3a4a;
  font-size: clamp(17px, 4vw, 21px);
  font-weight: 800;
  text-align: center;
}

#minigame-confirm-row {
  display: flex;
  gap: 14px;
  justify-content: center;
}

#minigame-confirm-row button {
  padding: 9px 34px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  font-family: inherit;
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
}

#minigame-confirm-yes {
  background: linear-gradient(180deg, #b7bec7, #9aa4b0);
  box-shadow: 0 3px 0 #79828d;
}

#minigame-confirm-no {
  background: linear-gradient(180deg, #ffb13d, #ff8f1f);
  box-shadow: 0 3px 0 #d96f00, 0 6px 16px rgba(255, 143, 31, 0.45);
  outline: 3px solid rgba(255, 177, 61, 0.55);
  animation: okPulse 1.6s infinite;
}

#minigame-confirm-row button:active {
  transform: translateY(2px);
  box-shadow: none;
}

@media (min-width: 768px) {
  #minigame-card {
    width: min(560px, 92vw);
    height: min(980px, calc(100dvh - 76px - 24px));
  }
}
