/* Winner Modal CTA Button */
.dmg-modal-cta-btn {
  background: #3A86FF;
  color: #fff;
  font-weight: bold;
  font-size: 1.15rem;
  padding: 12px 32px;
  border-radius: 10px;
  box-shadow: 0 2px 8px #3A86FF33;
  text-decoration: none;
  transition: background 0.18s;
  display: inline-block;
  margin-bottom: 8px;
}
.dmg-modal-cta-btn:hover {
  background: #2556b8;
}
/* Namespaced Daily Math Games How to Play Modal CSS */
.dmg-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 18px 24px;
  background: #fff;
  border-bottom: 1px solid #eee;
  font-family: system-ui, sans-serif;
}
.dmg-header-title {
  font-weight: bold;
  font-size: 1.3rem;
  margin-left: 18px;
  color: #3A86FF;
}
.dmg-howto-link {
  color: #3A86FF;
  font-weight: 600;
  text-decoration: underline;
  font-size: 1rem;
  margin-right: 12px;
  cursor: pointer;
  outline: none;
}
.dmg-howto-link:focus {
  box-shadow: 0 0 0 2px #3A86FF33;
}
.dmg-main {
  min-height: 60vh;
  padding: 32px 0;
  font-family: system-ui, sans-serif;
}
.dmg-game-placeholder {
  margin: 0 auto;
  max-width: 480px;
  padding: 32px 0;
}
.dmg-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: dmg-fadeIn 0.25s;
}
@keyframes dmg-fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.dmg-modal-card {
  background: #fff;
  color: #222;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(60,80,120,0.18);
  max-width: 720px;
  width: 96vw;
  padding: 32px 24px 24px 24px;
  position: relative;
  font-family: system-ui, sans-serif;
  animation: dmg-scaleIn 0.22s cubic-bezier(.4,1.4,.6,1.0);
}
@keyframes dmg-scaleIn {
  from { transform: scale(0.98); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.dmg-modal-title {
  font-size: 2rem;
  font-weight: bold;
  margin-bottom: 12px;
  color: #3A86FF;
  letter-spacing: -1px;
}
.dmg-modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  font-size: 2rem;
  color: #757E87;
  background: none;
  border: none;
  cursor: pointer;
  font-weight: bold;
  border-radius: 6px;
  width: 40px;
  height: 40px;
  line-height: 1;
  text-align: center;
  transition: background 0.15s;
}
.dmg-modal-close:focus {
  background: #E6B04E22;
  outline: none;
}
.dmg-modal-body {
  font-size: 1.08rem;
  line-height: 1.7;
  margin-bottom: 18px;
}
.dmg-modal-caption {
  font-size: 0.95rem;
  color: #757E87;
  margin-top: 8px;
  margin-bottom: 8px;
  font-style: italic;
}
.dmg-modal-legend {
  display: flex;
  gap: 12px;
  margin: 18px 0 10px 0;
}
.dmg-legend-box {
  min-width: 80px;
  height: 36px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
  font-size: 1.1rem;
  font-weight: bold;
  text-align: center;
  line-height: 32px;
  color: #fff;
}
.dmg-legend-green { background: #6FCF97; }
.dmg-legend-orange { background: #FF9500; }
.dmg-legend-gray { background: #757E87; }
.dmg-modal-example-row {
  display: flex;
  gap: 8px;
  margin: 10px 0 6px 0;
  justify-content: flex-start;
}
.dmg-modal-example-block {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #F3F4F6;
  font-size: 1.25rem;
  font-family: 'Menlo', 'Consolas', 'monospace', system-ui, sans-serif;
  font-weight: bold;
  color: #222;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px #0001;
  border: 2px solid #eee;
}
.dmg-modal-example-block.dmg-green { background: #6FCF97; color: #fff; border-color: #6FCF97; }
.dmg-modal-example-block.dmg-orange { background: #FF9500; color: #fff; border-color: #FF9500; }
.dmg-modal-example-block.dmg-gray { background: #757E87; color: #fff; border-color: #757E87; }
@media (max-width: 600px) {
  .dmg-modal-card { width: 98vw; padding: 18px 6vw 18px 6vw; }
  .dmg-modal-title { font-size: 1.3rem; }
  .dmg-modal-body { font-size: 1rem; }
  .dmg-modal-example-block { width: 32px; height: 32px; font-size: 1.1rem; }
}

/* Missing Digits Game Layout Constraints */
#game-content-area {
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: visible;
}

/* Ensure grid cells maintain aspect ratio and fit within viewport */
#game-content-area .grid {
  max-height: 50vh;
  width: fit-content;
  margin: 0 auto;
}

#game-content-area .grid > div {
  aspect-ratio: 1 / 1;
}

/* Ensure keypad remains at bottom and visible */
#keyboard-container {
  margin-top: auto;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}
