:root {
  --accent: #4388ae;
  --accent-dark: #285b78;
  --wash: #b7d9ed;
  --wrong: #ad473d;
}

body[data-direction="before"] {
  --accent: #7569ad;
  --accent-dark: #4e4679;
  --wash: #c9c3ea;
}

.number-order-stage {
  width: min(100%, 650px);
}

.sequence-card {
  position: relative;
  display: grid;
  overflow: hidden;
  min-height: min(33vh, 280px);
  min-height: min(33dvh, 280px);
  padding: 24px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent);
  border-radius: 34px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0.32)),
    var(--wash);
  box-shadow: var(--shadow);
  place-items: center;
}

.sequence-card::after {
  position: absolute;
  right: -38px;
  bottom: -48px;
  width: 122px;
  height: 122px;
  border: 2px solid color-mix(in srgb, var(--accent) 18%, transparent);
  border-radius: 50%;
  content: "";
}

.sequence {
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 6vw, 32px);
  font-family: "Nunito", sans-serif;
  font-size: clamp(5rem, 23vw, 8rem);
  font-weight: 900;
  letter-spacing: -0.05em;
  line-height: 1;
}

.sequence-card.is-changing .sequence {
  animation: sequence-pop 300ms cubic-bezier(0.2, 0.85, 0.35, 1.15);
}

.known-number { color: var(--ink); }

.sequence-arrow {
  color: var(--accent-dark);
  font-size: 0.52em;
}

.mystery-number {
  display: grid;
  width: 1.06em;
  height: 1.06em;
  place-items: center;
  border-radius: 0.28em;
  background: rgba(255, 255, 255, 0.72);
  color: var(--accent-dark);
}

.feedback {
  min-height: 25px;
  margin: 14px 0 10px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.feedback.is-correct { color: var(--accent-dark); }
.feedback.is-wrong { color: var(--wrong); }

.answer-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.answer-button {
  min-height: 68px;
  border: 2px solid color-mix(in srgb, var(--accent) 20%, var(--line));
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 8px 20px rgba(32, 48, 41, 0.07);
  color: var(--ink);
  cursor: pointer;
  font-family: "Nunito", sans-serif;
  font-size: clamp(1.8rem, 8vw, 2.45rem);
  font-weight: 900;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.answer-button:hover { transform: translateY(-2px); border-color: var(--accent); }
.answer-button:active { transform: scale(0.97); }
.answer-button:disabled { cursor: default; }

.answer-button.is-correct {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--wash) 54%, white);
  color: var(--accent-dark);
}

.answer-button.is-wrong {
  border-color: var(--wrong);
  animation: gentle-shake 280ms ease;
}

@keyframes sequence-pop {
  0% { opacity: 0; transform: scale(0.72) translateY(8px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes gentle-shake {
  0%, 100% { transform: translateX(0); }
  35% { transform: translateX(-5px); }
  70% { transform: translateX(5px); }
}

@media (min-width: 700px) {
  .sequence-card {
    min-height: min(38vh, 340px);
    min-height: min(38dvh, 340px);
    border-radius: 42px;
  }

  .answer-options { gap: 14px; }
  .answer-button { min-height: 80px; border-radius: 25px; }
}

@media (max-height: 650px) {
  .sequence-card { min-height: 205px; }
  .feedback { margin-block: 8px 6px; }
  .answer-button { min-height: 58px; }
}
