/* Keep the complete play grid in view on desktop without shrinking mobile targets. */
.topbar { height: 56px; }
main { padding-top: 14px; padding-bottom: 40px; }
.play-stage {
  display: flex;
  min-height: calc(100dvh - 110px);
  flex-direction: column;
  justify-content: center;
}
.intro { display: block; margin: 0; }
.intro > div:first-child {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.how-panel { display: none; max-width: 670px; margin-top: 14px; }
.how-panel.open { display: block; margin-bottom: 14px; }
.round-steps { display: none; }

.challenge {
  width: min(100%, 1100px);
  margin: 0 auto 18px;
  padding: 8px 16px;
  color: white;
  text-align: center;
  border: 2px solid #5c5f91;
  border-radius: 20px;
  background: #292b4c;
  box-shadow: 0 5px 0 #11121e;
}
.challenge strong { font-size: clamp(24px, 2.5vw, 31px); line-height: 1.1; }
.challenge.new-mission { animation: mission-attention 1s ease-out; }
.challenge.new-mission strong { animation: mission-text 1s ease-out; }

@keyframes mission-attention {
  0%, 55% {
    background: var(--lime);
    border-color: #abc956;
    box-shadow: 0 5px 0 #91ad4e, 0 0 0 6px rgba(202, 250, 112, .45);
    transform: scale(1.01);
  }
  100% {
    background: #292b4c;
    border-color: #5c5f91;
    box-shadow: 0 5px 0 #11121e, 0 0 0 0 rgba(202, 250, 112, 0);
    transform: scale(1);
  }
}

@keyframes mission-text {
  0%, 55% { color: #171821; }
  100% { color: white; }
}

@media (prefers-reduced-motion: reduce) {
  .challenge.new-mission {
    animation: none;
    background: var(--lime);
    border-color: #abc956;
    box-shadow: 0 5px 0 #91ad4e;
  }
  .challenge.new-mission strong { animation: none; color: #171821; }
}

.game-shell { width: min(100%, 1100px); margin-inline: auto; padding: 16px; }
.game-head { margin-bottom: 8px; }
.stat { padding: 8px; }
.stat strong { font-size: 38px; }
.status-row { min-height: 44px; }
.grid-wrap { width: min(100%, 640px, max(510px, calc(100dvh - 260px))); margin-inline: auto; padding: 8px; }
.number-grid { gap: 4px; }
.number-cell { font-size: clamp(16px, 2vw, 24px); }
.results { margin-top: 32px; }

@media (min-width: 760px) {
  .game-shell {
    display: grid;
    grid-template-columns: minmax(235px, 300px) minmax(0, 1fr);
    grid-template-rows: 1fr auto;
    align-items: start;
    gap: 14px;
  }
  .game-head {
    grid-column: 1;
    grid-row: 1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas: "time score";
    gap: 10px;
    margin: 0;
  }
  .game-head > .stat:first-child { grid-area: time; }
  .game-head > .score-stat { grid-area: score; }
  .status-row {
    grid-column: 1;
    grid-row: 2;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    padding: 0;
  }
  .status-row button { width: 100%; }
  .grid-wrap { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
}

@media (max-width: 759px) {
  .play-stage { min-height: 0; }
  .game-shell { padding: 12px; }
  .game-head { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .grid-wrap { width: min(100%, 580px); }
}

@media (max-width: 500px) {
  main { padding: 12px 12px 36px; }
  .challenge { padding: 10px; }
  .challenge strong { font-size: 24px; }
  .number-grid { gap: 6px; }
  .number-cell { font-size: clamp(17px, 4.8vw, 21px); }
}
